what if you wanted to use JSON to add it into localstorage? how could you since your using a function
@brytheitguy_3 жыл бұрын
Is it better to use onclick inside the button tag or adding the button to a variable and adding an event listener?
@WebDevCody3 жыл бұрын
I like adding it as an attribute of the element personally because it's easier to know what elements will do when the user interacts with them. It's similar to react, vue, angular, etc. Creating the event listener at a later time can get confusing since you don't know easily what elements do what.
@brytheitguy_3 жыл бұрын
@@WebDevCody Makes sense, thanks!
@WebDevCody3 жыл бұрын
@@brytheitguy_ after some more reading, it seems like a lot of people say inline functions are BAD, but I'm not convinced their reasoning is solid. There are some times you might need addEventListener, and using inline functions forces you to make global functions which can be dangerous. Anyway, it's not black and white; use what works for you.
@brytheitguy_3 жыл бұрын
@@WebDevCody Thanks for the follow-up!
@amoh96 Жыл бұрын
@@WebDevCody u mean arrow function >> inline function ? and do more this small practice love it alot help beginners like me thank you new here !!
@SeibertSwirl3 жыл бұрын
Good job babe!!
@amoh96 Жыл бұрын
new here , Keep it Niiiiiiiiiiiiiice
@kenansari3 жыл бұрын
Hi Cody, by adding this code "count = Math.max(count, 0)" it cannot go under 0. Do you have another approach?
@WebDevCody3 жыл бұрын
that's the approach I'd use. Then I'd wrap that in Math.min to put an upper limit in place if needed