setTimeout(function(){ alert("Sup!"); }, 2000);//wait 2 seconds
// wait 1000ms and then run func() let myTimeout = setTimeout(func, 1000); // cancel the timeout clearTimeout(myTimeout);