You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like the way you've used data-attributes to connect your HTML elements to the JS. You could actually go a step further and pass values using your data-attributes. E.g. instead of using the text content of the buttons here
You could pass the value of the button as data-number="4" etc, then access that with button.dataset.number. That way your JS implementation isn't so tied up with how the HTML is written. E.g. if you wanted the buttons to contain icons, or numbers written as words ("four")
The text was updated successfully, but these errors were encountered:
I like the way you've used data-attributes to connect your HTML elements to the JS. You could actually go a step further and pass values using your data-attributes. E.g. instead of using the text content of the buttons here
Calculator/script.js
Line 135 in 29d33c6
You could pass the value of the button as
data-number="4"
etc, then access that withbutton.dataset.number
. That way your JS implementation isn't so tied up with how the HTML is written. E.g. if you wanted the buttons to contain icons, or numbers written as words ("four")The text was updated successfully, but these errors were encountered: