On Sat, Apr 7, 2018 at 8:59 PM, Rob Ede <robjt...@icloud.com> wrote:
> ...I'm considering creating a proposal to add an Array.sort()
> method that takes an array and returns a new array...

That would be:

```js
let newArray = originalArray.slice().sort();
// or
let newArray = Array.from(originalArray).sort();
// or
let newArray = [...originalArray].sort();
```

I don't know that we need a new static for it. Unless the motivation is to
allow insertion sort or other sort algorithms that work best when creating
a new array as a result? But if we assume `Array.prototype.sort` already
uses quicksort or mergesort or similar, I'm not seeing much reason to add a
new static to allow insertsion sort or similar...

Can you expand on use cases and why the above aren't sufficient?

-- T.J. Crowder
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to