Answer the question
In order to leave comments, you need to log in
How to make a timeout with the assignment of classes in turn in an array of elements?
An array of three elements. Initially, all elements is-hidden
must be assigned a class in turn with the delay is-active
and loop it forever.
How to write a loop that iterates over this array? Why doesn't it work?
for(i = 0; i < this.elements.length; i++) {
setTimeout(function() {
this.elements[i].active = !this.elements[i].active
this.elements[i].hidden = !this.elements[i].hidden
}, 2500)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question