Why does it sort in place?
I’d prefer the more functional way
-
-
-
Sadly, that's how Array.prototype.sort has always worked. We can't go back and change it now, as doing so would break existing code.
- 2 more replies
New conversation -
-
-
Do you reckon this behaviour should be polyfilled for older browsers? If so, I'll open a pull-request on
@polyfillio shortly -
Ideally, yes!
End of conversation
New conversation -
-
-
Stack ranking dogs? That's a soul crusher.
-
Don't tell
@dog_rates!
End of conversation
New conversation -
-
-
Still dont get wat u mean with “stable”
-
The article explains it.
End of conversation
New conversation -
-
-
Not a fan of the sorting in place. I mean, I get that it's the purpose of sorting. But still... How would I go about sorting and assigning the result to a new variable without changing the original array? Do I need some sort of backup binding?
-
.slice().sort() like always has been the case
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
Array.prototype.sort is now stable in Chrome, Firefox, Safari, and Node.js!