← ⚡ JavaScript World
⚡ High Score Range
You can practise without a player, but pick a player to score points!
📖 The mission
Today you unlock
Functions return answers
A function is a tiny machine: it receives inputs, works something out, then returns one answer for the tests to check.
💡 Hint ladder
- Math.max(...scores) and Math.min(...scores) find the ends.
- Or loop once keeping a biggest and a smallest.
🧪 Coach checks
- ◯ range of 3,9,5
- ◯ all the same
- ◯ with negatives
- ◯ two numbers
Live coach
Getting ready
☆☆☆
💬 Math.max and Math.min with ... find the ends of an array in one go.
const scores = [3, 9, 5]; console.log(Math.max(...scores)); // 9 console.log(Math.min(...scores)); // 3
📟 It printed:
Nice — you saw it work!
📟 Output
🧩 Gaps filled! Ready to write it all yourself?