0
Whenever I click a button instead of increasing the steps by 1, it increases it by 4. Please help
2 Respuestas
+ 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
}
+ 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()})
}