Chapter 18. Controlling Flow with Conditions and Loops


• 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 ...

Get Sams Teach Yourself HTML, CSS and JavaScript All in One now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.