This is my object :
var obj = {
a:{ x:1 y:function(){return this.x //works fine},
b:{x:2,y:function(){return this.x // instead of returning 2, it's not returning anything}
}
Is there any constrain to give the name like this? Because each one belongs it’s own parent right? Still, why is it not working?
once you remove the several syntax errors it seems to work fine:
http://jsfiddle.net/SBpAF/