Why is my high score leaderboard sorting 100 below 20?
const rawScores = [45, 12, 100, 8, 230, 95, 5];
function formatLeaderboard(scores) {
const sorted = [...scores].sort();
return sorted.reverse().map((score, rank) => {
const badge = rank === 0 ? "👑" : "⭐";
return `${badge} #${rank + 1}: ${score} pts`;
});
}
function renderLeaderboard(scores) {
const entries = formatLeaderboard(scores);
const listContainer = document.querySelector("#arcade-board");
listContainer.innerHTML = entries
.map(entry => `<li>${entry}</li>`)
.join("");
}
renderLeaderboard(rawScores);
Reply with what is broken and how you would fix it.