Where in spec does it explain why setting the value of an existing property will change its [[Enumerable]] attribute.

John-David Dalton john.david.dalton at gmail.com
Wed Aug 17 06:52:34 PDT 2011


>> Array.prototype.reduce which is by default  { [[Writable]]: true,
>> [[Enumerable]]: false, [[Configurable]]: true } will change to
>> [[Enumerable]]: true when:
>> Array.prototype.reduce = function() {…};
> Why do you think this should change [[Enmerable]] to true??

Oh, I *didn't say* I think it should. I said we were trying to explain
an existing behavior we were seeing.

>> Would you all help point to where this is defined in spec?
> It isn't.  Simply assigning a new value to an already existing own data property isn't supposed to change any attributes.

Awesome! That was our conclusion too. It was late Kit and I missed
trying it in other implementations (instead we dug into spec because
we thought it was odd). It turns out V8 (Chrome, Node.js) has a bug
that will make non-enumerable properties enumerable by assigning a new
value as in my previous snippet :O

Thanks again,

More information about the es-discuss mailing list