JavaScript · Exercise 1 of 5Next
Beginner
Fix the like button that lost this
The Like button should add one to likes.count and show the new number. Right now clicking it shows NaN, because likes.add loses its this when it's passed to addEventListener.
Fix the last line so every click adds one to likes.count and the page shows the count. Don't change the likes object.
What Check tests
- One click shows
1 - A second click shows
2 - The count is stored on
likes, not on the button - No errors
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.