Sort, sortable string, sorted by ASCII code.
However, a comparison function may be through, to achieve more contents of the array, the array sorting function.
var arr = [40, 32, 45, 89, 93, 0, 46, 74]; var arr1 = arr.sort(function (a, b) { return a - b; }); console.log('升序:' + arr1); var arr2 = arr.sort(function (a, b) { return b - a; }); console.log('降序:' + arr2);