I tried to use sort function to arrange the items in order to find the largest element in a number array. In Chrome, inspect element and open the console.
>>var a = [1000, 1001, 857, 1]
>>undefined
>>a.sort()
>>(4) [1, 1000, 1001, 857] // no patern found.
Why did the numbers did not sort properly like they did for the other cases like these:
>>var b = [13, 27, 18, 26];
>>undefined
>>b.sort()
>>(4) [13, 18, 26, 27] // here the numbers are in ascending order.