JavaScript setTimeout() won’t wait to Execute? [duplicate]

alertBox()

Doesn’t this look like an immediate function call?

Try passing the function (without executing it) instead:

setInterval(alertBox, 5000);

Leave a Comment