var arr = [10,5,40,25,100,1]; function sortNumber(a,b){ return a-b; } alert(arr); alert(arr.sort(sortNumber));