How do you access the main obj from obj.foo.bar in javascript?
Posted
by bschaeffer
on Stack Overflow
See other posts from Stack Overflow
or by bschaeffer
Published on 2010-03-17T01:52:58Z
Indexed on
2010/03/17
4:11 UTC
Read the original article
Hit count: 203
JavaScript
Objects in javascript throw me for a loop!
In this set up...
var obj = {
someVar: "my awesome variable",
foo: {
bar: function(){
alert(this.someVar);
}
}
};
How would I get obj.foo.bar to correctly alert the value of someVar
?
© Stack Overflow or respective owner