there a some similar questions, but im still confused. because my case is function with params as parameter to another function.
Simple case:
var who = 'Old IE',
dowhat = 'eat',
mycode = 'my code :(',
text = 'I dont know why';
function whathappen(who, dowhat, mycode) {
alert(who + dowhat + mycode);
}
function caller(text, func) {
alert(text);
func();
}
question: how to do something like caller(text, whathappen(who, dowhat, mycode)); ? im not sure if we use anonymous function like caller(text, function(){ ... } (would that anonymous func. called twice?)
Thank you
dois a reserved word, see the syntax highlighting? Is that your real variable name? In the first example you're not passing a function tough, butundefined.whathappened(who, dowhat, mycode), which doesn't return anything. So what gets passed as the parameter isundefined