I need to run any js function each 1 second(for example), i want to make my functions as parameters. to run them any time.
My code is:
var refresh = function(callback, period) {
return window.setInterval(function() {
callback;
}, period);
};
var mFunction = function() {
console.log(new Date());
};
and to run that
refresh(mFunction, 1000);
but i can't get it.
any help please.