Command Palette

Search for a command to run...

Hectal
Phase 9: Events
JavaScript · Exercise 1 of 6Next
Beginner

A click counter with reset

Make the +1 button add one to the number in #count each time it is clicked, and the Reset button set it back to 0.

Use addEventListener, not onclick attributes in the HTML.

What Check tests

  1. Clicking +1 adds one
  2. Clicking +1 three times adds three
  3. Reset shows 0
  4. Counting starts again from 0 after a reset
  5. Uses addEventListener

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.