Recently when I was working with JavaScript \"sort()\" function, I found in one of the tutorials that this function does not sort the numbers properly. Instead to sort numbe
You can delegate the sorting to your own sort function:
function sortnum(a,b) { return parseInt(a,10)-parseInt(b,10); } var n = ["10", "5", "40", "25", "100", "1"]; alert(n.sort(sortnum)); //=>["1", "5", "10", "25", "40", "100"]