The code below is for the ascending order:
function sortNums(arr) {
let sorted = arr.sort((a, b) => a - b);
console.log(sorted.join(", "));
}
sortNums([4, 15, -1, 0]);
... and this is for the descending order:
function sortNums(arr) {
let sorted = arr.sort((a, b) => b - a);
console.log(sorted.join(", "));
}
sortNums([4, 15, -1, 0]);
with lambda function. See how to use arrow (lambda) functions here