setInterval(function google(){
console.log("Hello world")
//2000 is millisecond it means this program print hello world every 2 second
} , 2000)
Try other set interval code with a function call
setInterval(function google(){
//call other function whatever you want to execute
intervalcall()
} , 2000)
function intervalcall(){
console.log("Hello Fellow user")
}
Try other set interval code with a time to start trigger
setInterval(function google(){
if(new Date().getSeconds() == 20){
//In case date in minute you use "new Date().getMinutes"
//In case date in hours you use "new Date().getHours()"
console.log("Hello Fellow users, trigger on 20 seconds")
}
}, 1000)
Comments
Post a Comment