I have an JavaScript object defined as following...
var f = {
test: 'myTestContent',
app: {
base: {
action: function () {
alert(test);
}
}
}
};
f.app.base.action();
The problem is that I cannot access the test variable as defined in the f instance. Is it possible to access variables in this context from nested objects?
At the moment I get test is undefined. Any suggestions? Thanks!
f.test(BTW --testis not a global variable)testis actually not a variable–it is a property of the object stored in the variablef.testisn't global the way your question sort of implies, it is a property offso you can sayf.test.