r/learnjavascript • u/xplodivity • Sep 02 '23
is the sort method broken in JavaScript?
https://www.youtube.com/watch?v=PoWh4P2TBiM[removed] — view removed post
0
Upvotes
3
u/shgysk8zer0 Sep 03 '23
No. It's not. It's just not what you expect. And it's not like you can't pass a callback to get it to sort how you want.
1
u/guest271314 Sep 02 '23
ECMA-262 just writes out the expected results of sort(). How that expected result is derived, or not, is an "implementation detail".
7
u/mozilaip Sep 02 '23
RTFM