background preloader

Snippets

Facebook Twitter

My New Favorite Loop. I recently discovered a new way to loop through an array in JavaScript that doesn’t use the standby Array.length property to determine the number of iterations: var someArray = ["Dogs", "Cats", "Chickens"]; for (var a=0, o; o=someArray[a]; a++) { document.write(o + '<br/>'); } Here is how it works.

My New Favorite Loop

Squidfingers / news. The Assembly Gems page. TextDrive Snippets courtesy of Peter Coopers handy little app.