Back

DOM Challenges / Click Counter

00:00
1/20

Click Counter

Easy

Write a function setupCounter(button, display) that increments the display text content whenever the button is clicked.

  • 1

    Add an event listener to the button.

  • 2

    Maintain a count variable.

  • 3

    On click, increment count and update display.textContent.

JAVASCRIPT PLAYGROUND
JAVASCRIPT PLAYGROUND
⏳ Loading editor…