JavaScript’s sort: wonders never cease
>>> [1, 2, 10, 20].sort() [1, 10, 2, 20] >>> [3, "3", 3, "3", "3", "3", 3, 3, 3].sort() ["3", "3", "3", 3, 3, 3, "3", 3, 3]
The above was tested in Chrome 5. Sort varies by browser. Bedtime reading: ECMA-262 15.4.4.11 Array.prototype.sort(comparefn)