O'Reilly logo

HTML, CSS and JavaScript All in One, Sams Teach Yourself: Covering HTML5, CSS3, and jQuery, Second Edition by Julie C. Meloni

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 18. Controlling Flow with Conditions and Loops

What You’ll Learn in This Chapter:

How to test conditions with the if statement

How to use comparison operators to compare values

How to use logical operators to combine conditions

How to use alternative conditions with else

How to create expressions with conditional operators

How to test for multiple conditions

How to perform repeated statements with the for loop

How to use while and do...while loops

How to create infinite loops (and why you shouldn’t)

How to escape from loops and continue loops

How to loop through an array’s properties

Statements in a JavaScript program generally execute in the order in which they appear, one after the other. Because this order isn’t ...

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