← ⚡ JavaScript World
⚡ Double Trouble
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
- Multiplication in JavaScript uses the * symbol.
- return n * 2;
🧪 Coach checks
- ◯ doubles 4
- ◯ doubles 0
- ◯ doubles -3
- ◯ doubles 2.5
Live coach
Getting ready
☆☆☆
💬 This function multiplies by 10. Yours will multiply by 2 — same idea!
function timesTen(n) {
return n * 10;
}
console.log(timesTen(3)); // 30
console.log(timesTen(7)); // 70
📟 It printed:
Nice — you saw it work!
📟 Output
🧩 Gaps filled! Ready to write it all yourself?