To sort an array of integers with JavaScript, we call the sort
method.
For instance, we write
const numArray = [140000, 104, 99];
const sortedNumArray = numArray.sort((a, b) => {
return a - b;
});
to call sort
with a callback that returns a - b
to sort the `numArray entries in ascending order in a new array and return it.