Reputation: 303
Please, help to understand why is the line obj['prop'] = 'zzz';
doesn't work and even shows error when "use strict";
is on and works fine when Object.defineProperty(obj, 'prop', {value:'zzz'});
is used? (While delete
works absolutely fine)
//"use strict";
var obj = Object.defineProperties({}, {
prop: {
value: 'aaa',
writeable: true,
enumerable: true,
configurable: true
}
});
console.log(obj.prop);
obj['prop'] = 'zzz';
//Object.defineProperty(obj, 'prop', {value:'zzz'});
console.log(obj.prop);
//delete obj.prop;
//console.log(obj.prop);
Upvotes: 0
Views: 32
Reputation: 190907
Its writable
, not writeable
(notice no e
in the middle).
Upvotes: 2