O'Reilly logo

HTML5 Programming with JavaScript For Dummies by John Paul Mueller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9

Making the Rounds with Loops

In This Chapter

arrow Considering the need for loops

arrow Working with for loops

arrow Working with while loops

arrow Looping through objects

arrow Creating nested loops

Repetitive actions appear everywhere in the real world, so they also appear in applications. For example, you don’t do a single pushup and stop — you do a number of pushups to achieve a specific fitness goal. You’d be really surprised if an application allowed you to select a single menu item, performed the required task, and then ended so that it couldn’t perform any other tasks. Applications repeatedly ask you to select menu or other options to complete a particular goal that consists of many individual tasks. Repetition also appears inside the application. An application downloads individual pieces of a graphic, one piece at a time, until all the pieces appear on the local computer and the application displays them onscreen.

JavaScript supports several kinds of loops: for, while, do...while, and for...in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required