Object.keys(): Why no inherited properties?

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Wed Sep 7 09:29:30 PDT 2011


On 07.09.2011 19:33, Felipe Gasper wrote:
> Why does Object.keys() not allow, as an option, iterating through 
> inherited properties?
>

Because it's the same version that is from Prototype.js. I guess it was 
ported "as is" for compatibility with the library. But IMO, yes, native 
implementation could provide at least an option for this case (if 
needed). Though, that's said, you may implement in your way using 
`for-in` or getOwnPropertyNames + getPrototypeOf.

Dmitry.


More information about the es-discuss mailing list