Wrong behaviour in Google Chrome Object.defineProperty?
I am trying to create an object with setters and getters, and this is my code: var Player = function(height){ var _height = height; Object.defineProperty(this, 'height', { enumerable: false , configurable: true , writable: false , get: function(){return _height;} , set: function(val){_height = val;} }); } var myPlayer = new Player(10); Even though the writable property of the defineProperty options is set to false, I get the following error: Invalid property. A property cannot both have accessors and be writable or have a value, #<Object> The same is happening when the writable is set to true