JavaScript now has non-mutating array methods ✨
`toSorted()`, `toReversed()`, `toSpliced()`, and `with()` return new arrays instead of modifying the original.
No more [...arr].sort() to avoid side effects.
Learn more 👇
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted
MDN Web Docs
@mdn@mastodon.social
The official MDN Web Docs account. We deliver the best web docs around. Visit → https://mdn.dev Contribute → https://mdn.dev/community
mastodon.social
MDN Web Docs
@mdn@mastodon.social
The official MDN Web Docs account. We deliver the best web docs around. Visit → https://mdn.dev Contribute → https://mdn.dev/community
mastodon.social
@mdn@mastodon.social
·
Mar 07, 2026
17
0
7
Loading comments...