isPropertyEnumerable is going to stay broken?

Neil Mix nmix at
Mon Sep 10 14:41:26 PDT 2007

I think this is what Garrett is referring to:

js> function f() {}
js> = "blah";
js> var x = new f();
js> print(x.propertyIsEnumerable("foo"));
js> for (var n in x) print(n);

And I have to agree with him, the method is confusing.  Based on its  
name, I'd expect it to return true if the property can be enumerated  
via for-in loop on the given object, regardless of where the property  
exists in the prototype chain.

On Sep 10, 2007, at 4:27 PM, Brendan Eich wrote:

> On Sep 10, 2007, at 2:21 PM, Garrett Smith wrote:
>> And my point was that it appears to duplicate functionality of
>> hasOwnProperty in a differently named method.
> The two functions are different:
> js> var Op = Object.prototype;
> js> = 42;
> 42
> js> print(Op.hasOwnProperty('foo'), Op.propertyIsEnumerable('foo'));
> true true
> js> print(Op.hasOwnProperty('toString'), Op.propertyIsEnumerable
> ('toString'));
> true false
>> The fact that the method
>> was called propertyIsEnumerable instead of isPropertyEnumerable is  
>> not
>> great, but the way propertyIsEnumerable is designed is confusing to
>> developers.
> I've never heard that complaint directly, or in a
> report. Can you cite complaints anywhere on the
> web? I believe you, but it would be good to have evidence.
>> propertyIsEnumerable and hasOwnProperty are interchangeable (in
>> conforming hosts, not JScript)
> This statement is false.
> /be
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at

More information about the Es4-discuss mailing list