In javascript, if I have an infinite loop:
setInterval("popalert", 5000)
Where popalert() simply pops an alert box, what is the best way to make it such that an alert box does not pop up if there is already a single alert box that has not been closed yet?
There is no way to detect that the alert is there.
Do not use
setInterval, usesetTimeout.Reset the timeout after the alert happens.
jsfiddle example