Project 371: Count to 21

6. Add buttons for "+2" and "+3"

In this challenge, we're going to add two more buttons with click handler code so we can completely simulate the actions in "Count to 21".
Starting point link for this challenge

Your goal

Steps

1. Add "+1" and "+2" buttons with distinguishing classes

You'll need to add two more buttons to get the game working, but you'll also need to add classes to the buttons so your JavaScript code can tell them apart.

Don't forget to update the click handler for "+1" with the new class name as well.

2. Add a click handler for the "+2" button that increases the counter by 2

Use the existing "+1" click handler as an example.
var counter = 0; document.addEventListener('click', function(event){ if (event.target.matches('.plus-one')){ counter = counter + 1; alert(counter); } if (event.target.matches('.plus-two')){ counter = counter + 2; alert(counter); } });

3. Add a click handler for the "+3" button that increases the counter by 3

Use the existing "+1" click handler as an example.
var counter = 0; document.addEventListener('click', function(event){ if (event.target.matches('.plus-one')){ counter = counter + 1; alert(counter); } if (event.target.matches('.plus-two')){ counter = counter + 2; alert(counter); } if (event.target.matches('.plus-three')){ counter = counter + 3; alert(counter); } });