1

You can never stop learning JS

Comments
  • 10
    But maybe if you read the docs then people will see it is based on Unicode string compare by default. So this result is expected unless you provide a sorting method
  • 3
    @jespersh still, its not what I would have expected either.

    But I almost always provide a sort function anyway.
  • 1
    @jespersh It's expected behaviour when integers are compared as unicode strings by default?

    What's next, comparing Strings as boolean arrays? Just mention it somewhere in the docs, it'll be fine.
  • 1
    I know almost nothing about JavaScript. The one thing I remember from some intro chapter is that everything in JavaScript is basically stored in a big string to string dictionary. So, I immediately thought "Oh, alpha sorting". Perhaps that's the key to JavaScript: knowing the absolute minimum is less confusing 😀.
Add Comment