var o = {}, myName = 'erik'; Object.defineProperty(o,'name',{ configurable: true, enumerable: true, set: function(name) { this._name = true; this._name = name; console.log(name) console.log(this) }, get: function() { return this._name; } }); o.name = 1