How to Code an Increment Decrement Counter - Beginner Javascript Practice

preview_player
Показать описание
A tutorial showing you how to build a simple html counter where we can increment and decrement a state number by clicking a plus and minus button. If you don't know how to build this yourself, then be sure to checkout the other videos of this series.

------------

Рекомендации по теме
Комментарии
Автор

what if you wanted to use JSON to add it into localstorage? how could you since your using a function

OfficialNinjagoCentral
Автор

Is it better to use onclick inside the button tag or adding the button to a variable and adding an event listener?

brytheitguy_
Автор

Hi Cody, by adding this code "count = Math.max(count, 0)" it cannot go under 0. Do you have another approach?

kenansari