JavaScript setTimeout
setTimeout(function(){ alert("Hello"); }, 3000);
Bald Eagle
setTimeout(function(){ alert("Hello"); }, 3000);
setInterval(function(){
//this code runs every second
}, 1000);
setInterval(function(){
console.log("Oooo Yeaaa!");
}, 2000);//run this thang every 2 seconds
setTimeout(function(){
//code goes here
}, 2000); //Time before execution
setInterval(function(){
console.log("Hello World!");
}, 2000); //run this script every 2 seconds(specified in milliseconds)
// setInterval is used to run a piece of code everytime
// a certain amount of time which is defined in ms has been elapsed.
// Basic syntax is as follows:
// setInterval(callback, time);
setInterval(() => {
alert("just checking on you :)");
}, 5000); // displays an alert after every 5 seconds