Subj : Re: Enumeration of extended properties of Array and Object prototypes To : Chris Zumbrunn From : Brendan Eich Date : Fri Mar 19 2004 07:00 pm Chris Zumbrunn wrote: > Brendan Eich wrote: > > >>Chris Zumbrunn wrote: >> >>>I understand that in accordance with the ECMA specs both Spidermonkey >>>and Rhino make that additional methods added to Objects are enumerated >>>in Javascript for/in loops. >> >>What do you mean, exactly? Can you give an example? >> >>/be > > > Array.prototype.foo = "bar"; > var a = new Array(1,2,3); > for (var i in a) {x += i} > > x is 123foo, but I'd want it to be 123 ECMA dictates that it should be "123foo". Did you mean that native code defined 'foo' as some kind of built-in? In that case, the native code can use ECMA DontEnum, or in SpiderMonkey terms, can not use JSPROP_ENUMERATE. If you mean exactly what you show as an example, then there's no way any conforming implementation can avoid enumerating 'foo'. /be .