Subj : Re: Enumeration of extended properties of Array and Object prototypes To : Chris Zumbrunn From : Brendan Eich Date : Sun Mar 21 2004 11:12 am Chris Zumbrunn wrote: > > OK, so there will still be no way to make a user-defined dynamic or > class property non-enumerable. Not unless something has changed in the ECMA working draft. >>Why do you want this, exactly? For what purpose? > > Hmm, I'm surpised you're asking. What's the point of being able to add > custom methods to the Object or Array prototypes if doing so will break > any application that uses for/in loops? I'm asking for a real-world example where such a loop breaks because of the user-defined prototype property. Almost all such loops that I've seen are inspecting/debugging loops, where the added prototype properties can be filtered out, by script or by the reader. It's not ideal, but it's not a fatal ("will break") situation. An easy way for scripts to filter is to use Object.prototype.hasOwnProperty: for (var i in o) { if (o.hasOwnProperty(i)) print(i, o[i]); } It's easy to imagine for..in loops that are critical to a script, and that would fail in light of user-defined prototype properties. But I didn't want to imagine, I was looking for reality ;-). /be .