Practice ยท 1 of 1
Build a Click Counter
Elements button (a "increment" button) and display (shows the count) are provided as variables.
1. Add a click listener to button that increases count (starting at 0) and updates display.textContent with the new count.
2. To prove it works, simulate two clicks by CALLING the handler logic twice, then log display.textContent โ it should print 2.
Tip: keep the handler in a variable or use a named function so you can call it yourself.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Events: Listening and Reacting โ Practice