Js error on click event.

Trying to make a passenger counter app and stuck on getting my save button functionality to work. I get this error "'saveNumber' is declared but its value is never read.ts(6133)" when I try to set a saveNum var on line 27. I'm not understanding what I'm doing wrong here? https://codepen.io/ezekielswanson/pen/MWBdZbP
2 Replies
lko
lko2y ago
I dont get any error Try refreshing the page
zekeswanson
zekeswanson2y ago
In this function saveEl.addEventListener('click', function() { let saveNumber = count + " - "; }); It works if I remove let and just set saveNumber = count + " - "; But i'm confused as to why that is? can I not set let b/c I'm already setting count = 0 at the top?
Want results from more Discord servers?
Add your server