O'Reilly logo

Sams Teach Yourself HTML, CSS and JavaScript All in One 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 variables with the if statement

• How to use various 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 for a different type of loop

• How to use do...while loops

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

• How to escape from loops and continuing loops

• How to loop through an array’s properties

Statements in a JavaScript program generally execute in the order in which they appear, one ...

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