Just wanted to add this to
You can change the attributes the first time you create an object as follows:
var newObj = Object.defineProperty({}, 'aPropertyName', { enumerable:false, writable:false, configurable:false });
You can also change several properties at once:
var newObj = Object.defineProperties({}, { aPropertyName: {enumerable: false, writable: false, configurable: false}, anotherPropertyName: {enumerable: true, writable: true, configurable: false}, finalPropertyName: {enumerable: true, writable: false, configurable: true}, });
And, of course, passing the name of the object using the previous method:
Object.defineProperties(objectName, { aPropertyName: {enumerable: false, writable: false, configurable: false}, anotherPropertyName: {enumerable: true, writable: true, configurable: false}, finalPropertyName: {enumerable: true, writable: false, configurable: true}, });