Sort method to sort arrays
The sort method sorts the elements of an array according to the callback function.
For example on an array of numbers:
function ascendingOrder(arr) {
return arr.sort(function(a, b) {
return a - b;
});
}
ascendingOrder([1, 5, 2, 3, 4]); // =>...
plasebo.hashnode.dev2 min read