Hello everybody.
I working with jQuery and i needed to generate an anonymous method with the eval() function.
The following lines worked with Opera but not with IE, FF, Chrome:
var callbackStr = "function(){alert('asdf');}";
var callback = eval(callbackStr);
callback();
This code works with all Browsers:
var callbackStr = "var callback = function(){alert('asdf');}";
eval(callbackStr);
callback();
You see, I already solved my problem. But I want to know, what exactly is happening. Can anybody explain this behaviour to me, or tell me where i can find further information?
(PS: I know this page.)