Answer the question
In order to leave comments, you need to log in
Is it possible to execute the same interval in parallel?
There is an interval:
setInterval(function(){
//код, который выполняется 5000 миллисекунд
}, 1000);
Answer the question
In order to leave comments, you need to log in
JavaScript is single threaded .
setInterval does not create a separate thread, but adds a function call to the queue, which is checked in free time.
Also, two setIntervals will never run in parallel - first one, then the other.
The answer to the question: will wait and score on the interval.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question