Run a function every 30 seconds javascript

Based on the answer from "Schechter" but fixed to run on the first page load and then runs every 30 secs.

function myFunction(){
    console.log('myFunction Called')
}

myFunction();

setInterval(function(){
    myFunction()
}, 30000)

function foo(){
    console.log('function is being called')
}

setInterval(function(){
    foo()}, 30000)

The second argument in setInterval is the time delay in milliseconds, so use 30000 for 30 seconds, not 30.


function blah(){}

blah();
setInterval(blah,30000);