javascript sort array numbers desc code example
Example 1: sort numbers in array javascript
function sortNumber(a, b) {
return a - b;
}
Arr.sort(sortNumber);
Example 2: javascript sort numbers descending
var numArray = [140000, 32, 12, 63323, 104, 99];
numArray.sort(function(a, b) {
return b - a;
});
// Array(6) [ 140000, 63323, 104, 99, 32, 12 ]