today I found something interesting about array prototype sort
.
var numbers = [1,7,23,11,50,60];
So I created an array of numbers and wanted to sort them. So I used
console.log(numbers.sort()) //-> [1, 11, 23, 50, 60, 7]
The result was weird, [1, 11, 23, 50, 60, 7]
. What is wrong with the sort function?
var numbers = [1,7,23,11,50,60];
alert(numbers.sort())