Not in the design you are there, no.
The main reason is that outer doesn't actually exist when you are inside inner .
If you changed the inner properties to functions, you could access outer at run time, but that would be pretty ugly code.
Use new outer(); instead and create the object this way, then you can use this inside inner , but then it is a completely different construction and will look something like
var outer = function() { this.x = 0; this.inner = { a: this.x + 1 }; }; var b = new outer(); console.log(b.inner.a);
Martin jespersen
source share