0
Always error when i click button
I want to add numbers to the array every time I click the button and display the element array on the p element with id = "demo". but instead an error 'occurred when I felt there was nothing wrong with my code, someone help me solve this error problem' and explain to me why this could happen. https://code.sololearn.com/WFg82Ck9lSW9/?ref=app
5 odpowiedzi
+ 1
I've debugged your code, here it is :
https://code.sololearn.com/W6QU3vsTWqBO/?ref=app
+ 1
You wrote
1) object.innerHtml instead of object.innerHTML
2) your event Listener was defined in a bad way : instead of having like the following, you added a { as if all your function was an object : idBtn.addEventListener("click",function(){...})
+ 1
geez I'm so careless 😥 Thank you very much for answering
0
LISANGOLA BONDJALI CHRISTIAN Is this because I didn't assign a value to variable a? But before that, thank you for answering my question
0
Juste see your code where you add the event listener, how the callback is defined