JavaScript · Lesson 2 of 4

Count button clicks

let keeps a number you can change. Increase it on each click, then display it. Running the code again starts the counter at zero.

Your task

Change the increase from 1 to 2. Run the code and click three times. What number appears?

Each new lesson builds on your personal page. Your saved lesson draft opens when you return.

The image stays in your browser. Choose it, then use its filename when you add the image to your code.

Edit your project HTML and CSS

Your page

Checks use your current code. Try the page yourself too.

Did you get 6? Restore the increase to 1 and try again, then move on to showing details.

Next: Show details