0

Whenever I click a button instead of increasing the steps by 1, it increases it by 4. Please help

https://code.sololearn.com/WG15BGkIy3X8/?ref=app

30th Jun 2021, 10:01 AM
Olorunsogo Abiodun Isaac
Olorunsogo Abiodun Isaac - avatar
2 Antworten
+ 1
for (o=0;o<outcome_span.length;o++){} var stairs = { A lot of code } I think must be for (o=0;o<outcome_span.length;o++){ var stairs = A lot of code }
30th Jun 2021, 10:23 AM
Shadoff
Shadoff - avatar
+ 1
You are assigning 4 event listeners to each element. for (let a=0;a<document.querySelectorAll(".direction").length;a++){ direction[0].addEventListener("click",function(){return stairs.up()}) direction[1].addEventListener("click",function(){return stairs.down()}) const upup= direction[2].addEventListener("click",function(){return stairs.upup()}) const downdown= direction[3].addEventListener("click",function(){return stairs.downdown()}) }
30th Jun 2021, 10:33 AM
arturop200
arturop200 - avatar