Answers for "execute function according to time javascript"

2

javascript after time call function

/*
You can use JavaScript Timing Events to call function after certain interval of time:

This shows the alert box every 3 seconds:
*/

setInterval(function() {alert("Hello")},3000);

/*
1. setInterval(): executes a function, over and over again, at specified time intervals
2. setTimeout() : executes a function, once, after waiting a specified number of milliseconds
*/
Posted by: Guest on April-27-2021
0

set function to execute at certain time js

//year, month 0-11, date, hour, min (can add ,sec,msec)
var eta_ms = new Date(2015, 0, 21, 17, 0).getTime() - Date.now();
var timeout = setTimeout(function(){}, eta_ms);
Posted by: Guest on September-01-2021

Code answers related to "execute function according to time javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language