var a={}, b; a[b]=0; Object.defineProperty(window, "c", { get: function () { return a[b]; }, set: function (v) { a[b]=v; }, enumerable: true }); c++; alert(a[b]);