Hi,
That for..in code is incorrect, based on a misconception (a common
one). This page explains the misconception and discusses correct ways
of iterating through arrays:
http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays
HTH,
--
T.J. Crowder
Independent Software Consultant
tj
Thanks!
That other way worked fine for me.
//Daniel
On Feb 22, 4:08 pm, T.J. Crowder t...@crowdersoftware.com wrote:
Hi,
That for..in code is incorrect, based on a misconception (a common
one). This page explains the misconception and discusses correct ways
of iterating through
TJ,
i see endless warnings against using for/in. And i understand the
reasons for them, especially on arrays. But it seems like a fairly
powerful looping tool, yet no one seems to temper the warnings with
appropriate circumstances for its use. Since the JS spec disallows
creating non-enumerable
Hey Joe,
ARE there any good uses for this
loop method?
Absolutely, I use it all the time! Remember that as the linked article
says:
...`for..in` is not for iterating through the /indexes/ of an
/array/. `for..in` iterates through the /property names/ of an
/object/. Arrays are objects,