ES4 draft: Object

Andrea Giammarchi andrea at
Fri Mar 7 00:24:44 PST 2008

Garrett Smith wrote:
> obj = {dontenum length: 10} );
> vs.
> obj = {length: 10};
> obj.propertyIsEnumerable("length", false);
> Which is more ugly?
> Garrett
Of course I prefere the first line but these two cases are different.
I wonder if a builtin method will not cause more problems instead of 
avoiding them.

What I mean is what is the expected behaviour in this case?

Object.prototype.propertyIsEnumerable("length", false);
// some stuff ... and then ...  
Object.prototype.propertyIsEnumerable("length", true);

I think Object.prototype is the perfect case scenario where this built in method could cause more chaos than ever, while the dontenum in declaration makes sense specially when I write my own object and/or prototoype and I would like that no one will be able to change my not enumerable property. So I guess built in method is error/conflicts/problems prone while the first one is quite safer (and at the same time, I do like to know if others add some Object.prototype, both to avoid conflicts, problems, and errors)

These are only my 5 cents to this interesting discussion.

Kind Regards

Zend Certified Engineer
ActionScript 2.0 Certified Developer
Web 2.0 Specialist
Cel. +39 338 7621067

More information about the Es4-discuss mailing list