Closed GoogleCodeExporter closed 8 years ago
Those hasOwnProperty checks seem to be unnecessary: all those objects are
simple JS data structures with __proto__ === Object.prototype, e.g. no non-own
properties are being enumerated... ?
Original comment by ondrej.zara
on 17 Jun 2011 at 10:08
Some of JS developers would say that hasOwnProperty check should be an integral
part of for..in loop. Even if there is nothing added to object's prototype.
However it is just theoretical discussion. In practice - I never had a need to
navigate through prototype properties of an object, this is why I always add
the check. In such case I never have to bother when I add something enumerable
to the prototype...
Original comment by ddrcode
on 20 Jun 2011 at 9:10
I can guarantee that I *never* modify Object.prototype, which is why adding
hasOwnProperty check to "for (var p in {})" is redundant...
Also, consistently, I never enumerate non-Objects with "for (var p in what)" -
which is why I can freely extend their prototypes :)
Original comment by ondrej.zara
on 22 Jun 2011 at 8:07
Revision 918 applies those parts of this patch which optimize array length
getters in loops.
Original comment by ondrej.zara
on 27 Jul 2011 at 11:26
Thanks, the array lengths were the most important.
Original comment by ddrcode
on 3 Sep 2011 at 11:39
Original issue reported on code.google.com by
ddrcode
on 16 Jun 2011 at 10:08Attachments: