var foo = { x: 1, y: (function () { return this++this.x; })() }; console.log(foo.y); // undefined rather than 2 Let's say that I want to be able to reference foo.y without using foo.y()I want to be able to reference foo.y without using foo.y(). Is that possible?
The above obviously doesn't work, and I'm assuming it is because closure changesreferences a different this.