I have two questions related to the JavaScript's setInterval() method.
I haven't found any practical cases (but I guess it's not impossible also) related to these question, but for curiosity I wanted to ask these questions.
What happens if the code to be be executed by the
setInterval()takes more time than the time interval provided? Does the previous execution stops and the current one starts executing or both will run in parallel.What if the whole system (OS) is hanged between the time gap when
setInterval()is called? Is it possible that the code can execute with some different interval during this condition? I mean doessetInterval()guarantees that the code will be executed at the specified interval only? Thanks