Put Things in the Right Order
JavaScript
20 pts
Put Things in the Right Order
The starter crashes because it uses player and goals before their let lines. Fix it like a pro:
- Move
let playerandlet goalsabove theconsole.loglines. - Below the main program, write two function declarations:
welcome(name)returnsWelcome to Keren FC, Merhawi!(with the given name), andgoalsMessage(count)returns"No goals yet"for 0,"1 goal"for 1, and for example"7 goals"for more.
The output must be:
Welcome to Keren FC, Merhawi! 7 goals 1 goal No goals yet
Checklist
- Declare
playerandgoalsbefore they are used. - Write
welcome(name). - Write
goalsMessage(count)for 0, 1 and more goals. - Keep both helpers as function declarations below the main program.
- The four lines are printed.
🔑 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.
