This function have 2 parameter:
- Function to be executed
- Timeout time per millisecond
Example #1:
setTimeout(function() {Explanation: code alert "timeout testing" will be run after 1 second setTimeout executed.
alert("timeout testing");
}, 1000);
Example #2:
function runAlert() {Explanation: function runAlert() will be run after 2 second setTimeout code executed.
alert("inside function");
}
setTimeout(runAlert(), 2000);
That's all for setTimeout javascript function and I hope this is helpful 😇