Command Palette

Search for a command to run...

Hectal
Phase 1: Values, Types and Variables
JavaScript · Exercise 1 of 5Next
Beginner

Keep score with const and let

Make a tiny score keeper. Declare a constant playerName with the value "Asha" and a variable score that starts at 0.

Add 10 to score, then add 5 more, by reassigning the variable (don't just write 15).

Show the text Asha: 15 points in the paragraph with id out. Don't use var.

What Check tests

  1. The page shows Asha: 15 points
  2. playerName is declared with const
  3. score is declared with let and ends at 15
  4. No var anywhere

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.