I'm doing this but it isn't working:
function timer(func){
//Timer code here
...
func();
}
function doSomething(){
var param1;
var param2;
var execute = function(){
alert(param1 + " - " +param2);
};
}
var instance = new doSomething();
instance.param1 = "Hi";
instance.param2 = "Test";
timer(instance.execute);
Why isn't my instance function "execute" executing inside the timer function? I got the following error: Uncaught TypeError: func is not a function
What would be the correct way?