Removing 'for each' from Javascript examples


In the recent Javascript examples posted here, I'd used for each (var item in items)… for iterating through objects and arrays. This is neat and convenient, but a) for each shouldn't be used with arrays and b) it doesn't work in WebKit/Safari and IE.

I've now updated the examples to use standard for loops, replacing

for each (var item in items)
for (var i = 0, item; item = items[i++];)

Aside: if you're reading a Planet that contains HubLog, those posts will all jump to the top - sorry! (I wish Planets dealt better with small updates so I didn't have to worry about it).