javascritp set timeout code example
Example 1: javascript settimeout
setTimeout(function(){
alert("Sup!");
}, 2000);//wait 2 seconds
Example 2: javascript timeout
// wait 1000ms and then run func()
let myTimeout = setTimeout(func, 1000);
// cancel the timeout
clearTimeout(myTimeout);