News for hackers. Stuff that matters.
Re:The Curious Case of JavaScript’s `sort` by andreapaiola on Wednesday April 13, 2016 @10:57AM (#11488691)
Ah ah nope!

You should read MDN

The default sort order is according to string Unicode code points.

If compareFunction is not supplied, elements are sorted by converting them to strings and comparing strings in Unicode code point order. For example, "Banana" comes before "cherry". In a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in Unicode order.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:The Curious Case of JavaScript’s `sort` by Klathmon on Wednesday April 13, 2016 @11:48AM (#11489205)
And just to throw another wrench in there, because it sorts by Unicode code points, capitals come before lowercase.

So this:

['Banana', 'cherry', 'bagel', 'apple'].sort()

Will produce this order:

["Banana", "apple", "bagel", "cherry"]

Re:The Curious Case of JavaScript’s `sort` by glitcher on Wednesday April 13, 2016 @11:09AM (#11488794)
Yet another reason why you shouldn't have read W3 schools.