[jQuery] vars in unnamed functions
this isn't the real code, just a mockup, but ...
can someone explain to me why this works (as in, alert echoes 'ariel'):
var temp = null;
function init ()
{
var aVariable = 'ariel';
var settings = {
functionToCallLater: function (content) {
alert(aVariable);
}
};
temp = new anotherClass(settings);
}
anotherClass.callThatFunction();