cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript for(node in nodes)

dinger
Champ in-the-making
Champ in-the-making
Should the following code work:

for(node in nodes)
{
    // do something with each node
}
Where nodes is, for instance, space.children?

This wouldn't work for me. I had to revert back to a bog standard loop like this:
for(var i=0;i<nodes.length;i++)
{
   var node = nodes[i];
}

Cheers

Rob
1 REPLY 1

jpfi
Champ in-the-making
Champ in-the-making
Hi,
you missed the each:

for each (node in nodes)
{
    // do something with each node
}

Cheers, Jan