Send to Printer

js4u

JS 4 U 16: Iteration

December 14, 2010 8:24:55.864

Javascript 4 U

Today's Javascript 4 You. Today we look at one of the more useful looping consyructs in Javascript - it's a lot like the iterators in Smalltalk. If you have trouble viewing it here in the browser, you can also navigate directly to YouTube.

Join the Facebook Group to discuss the tutorials. You can view the archives here.

To watch now, click on the image below:

Prompters

If you have trouble viewing that directly, you can click here to download the video directly. If you need the video in a Windows Media format, then download that here.

You can also watch it on YouTube:

Technorati Tags: , ,

Enclosures:
[js4u16-iPhone.m4v ( Size: 1950301 )]

posted by James Robertson

Comments

Re: JS 4 U 16: Iteration

[Peter Galiba] December 15, 2010 10:12:03.378

Do NOT EVER use for..in loop to iterate over an array. Example:

var arr = [0, 1, 2, 3, 4],

sum = 0,

m;

for (m in arr) {

sum += m;

}

// sum: "001234"

for..in loops are to iterate over an object's properties.

 Share Tweet This