Proposal: Static sort method on Array

Rob Ede robjtede at icloud.com
Sat Apr 7 19:59:58 UTC 2018


I don't like the fact the only way to sort is in-place with Array#sort and I can't be the first to feel this way or wonder why there isn't a built-in solution.

Obviously, searching "javascript array.sort" doesn't produce any helpful results to see if someone has suggested this before since all the results relate to Array#sort.

I'm considering creating a proposal to add an Array.sort() method that takes an array and returns a new array. It seems like such a simple addition that would remove the need to import lodash, write a helper function or use a slightly less clear and possibly slower technique like `[...arr].sort()`.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180407/87773edb/attachment-0001.sig>


More information about the es-discuss mailing list