for own(...) loop (spin-off from Re: for..in, hasOwnProperty(), and inheritance)
Brendan Eich
brendan at mozilla.com
Tue Nov 8 15:39:59 PST 2011
On Nov 8, 2011, at 2:26 PM, John J Barton wrote:
> On Tue, Nov 8, 2011 at 1:45 PM, Timmy Willison <timmywillisn at gmail.com> wrote:
>> Yes, I think JS needs something like this. This is new to no one here, but
>> my main concern with using hasOwnProperty is the loss of performance, so I
>> think it would be worth exploring more than just syntactic sugar. But I
>> don't know how realistic it is to hope for that.
>> http://jsperf.com/hasownproperty-vs-for-in/4#c300
>
> Added case Object.keys().forEach:
>
> http://jsperf.com/hasownproperty-vs-for-in/7
Also, isn't this like jsperf.com? Random people running on different machines upload results without any normalization?
Just asking, not really my point (since I think performance is only one consideration, and for non-large objects probably not significant unless "the loop" is called at high frequency).
/be
More information about the es-discuss
mailing list