A leaderboard needs numeric order, but the incoming scores should stay untouched. Sort a copy and reverse another copy in script.js; compare both in the Console.
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 raceTimes = [48, 42, 55, 45];
const leaderboard = [...raceTimes].sort((a, b) => a - b);
console.log(leaderboard);
reversedNumbers by reversing a copy of sortedNumbers, leaving the original sorted; the supplied probe prints both arrays.Use a copy like [...numbers] before sorting so you do not lose the original array.
Call reverse() after sorting if you want descending order.