puzzle 01 · javascript

What does this log?

console.log([10, 9, 1].sort());
[1, 9, 10]
[1, 10, 9]
[10, 9, 1]
[9, 10, 1]

why

Array.prototype.sort() coerces elements to strings and compares them lexicographically unless you pass a comparator. "10" sorts before "9" because "1" < "9". Always pass (a, b) => a - b for numbers.

Today's puzzlea new one every day, and a streak to keep