JavaScript · Exercise 6 of 6 Previous
Intermediate
A sortable, searchable leaderboard
Build a leaderboard from the players array. Each player is a table row in #rows: first cell the name, second cell the score.
Sort by score shows the highest score first; players with the same score go in A-to-Z order. Sort by name shows names A to Z. Before any button is clicked, show players in their original order.
Typing in #search shows only players whose name contains the text, ignoring capital letters, and keeps the current sort.
Never change or reorder the players array itself.
What Check tests
- All 5 players show in their original order at first
- Sort by score: highest first, ties A to Z
- Sort by name: A to Z
- Searching "R" shows only Kabir, Meera and Ravi (still sorted by name)
- Switching to score keeps the search
- Clearing the search shows everyone again
- The players array itself was never reordered
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.