"josh" <xd********@gmail.com>
If I have, for example,
BB =
{
CC =
{
makeDecision : function()
{
return "ko";
},
b : isOk ? "ok" : makeDecision()
}
}
now if I done
BB.CC.b where isOK == false;
than I have na error that makeDecision() is not defined
I am learning myself, so bear with me.
This has to do with the scope chain. The scope chain is altered when you
enter/leave a function. But you do not enter a function. You have an object
BB with property CC which is an object with two properties: makeDecision and
b. But 'entering' an object does not change the scope chain. BB.CC.b =
makeDicision() will be looking for makeDecision in the global execution
context. But it is not a property of the global variable and thus not
defined.
A solution would be to call BB.CC.makeDecision()
Tom