Sort the Scores
JavaScript
10 pts
Sort the Scores
Sort the array scores from low to high with sort() and a compare function. Then print the array, the lowest and the highest score:
[ 9, 18, 45, 72, 100 ] Lowest: 9 Highest: 100
After sorting, read the lowest with scores[0] and the highest with scores[scores.length - 1].
Checklist
- Sort
scoresfrom low to high with a compare function. - Read the lowest and the highest score by index.
- Print the three lines.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
