Sorting and reversing are two common array operations that beginners often use together. This lesson keeps the data small and the output explicit so the order is easy to verify.
const numbers = [3, 1, 4, 2];
const sortedNumbers = [...numbers].sort((a, b) => a - b);
const reversedNumbers = [...sortedNumbers].reverse();
Use a copy like [...numbers] before sorting so you do not lose the original array.