League Points
JavaScript
10 pts
League Points
Keren FC starts the season with let points = 0;. Update points after every match and print it each time with console.log("Points:", points);:
- A win: add 3 with
+=. - Another win: add 3 again with
+=. - A draw: add 1 with
++. - A penalty from the league: subtract 2 with
-=.
Expected output:
Points: 3 Points: 6 Points: 7 Points: 5
Do not type the totals yourself — let the operators calculate them.
Checklist
- Add the two wins with
+=. - Add the draw with
++and the penalty with-=. - Let the operators do the maths;
pointsends at 5. - Print the points after every match.
🔑 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.
