It is very easy to execute some code after a specified time-interval, i.e. setting some time interval between the code. We can use the setTimeout function.
Here is the code:
setTimeout(function() {
alert("hello");
}, 1000);
The basic structure is setTimeout(function, time in ms)
Hope it helps. Thanks.