Vanilla JavaScript setTimeout
code snippet to delay a function call.
setTimeout(function(){
alert("Hello after 2 seconds");
}, 2000); // wait 2 seconds
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.