Chapter 6
Getting into the Flow with Loops and Branches
In This Chapter
Finding out about if/else branching
Understanding the different types of loops
Using loops to repeat statements
Looping through the values of an array
“It's not hard to make decisions when you know what your values are.”
— Roy Disney
In earlier chapters of this book, we generally talk about and demonstrate linear JavaScript code. However, more often than not, there comes a time (many times, actually) in a program where you need a choice to be made or where you need to alter the straight-ahead logic of a program to repeat statements multiple times with different values. In this chapter, we discuss looping and branching statements.
Branching Out
Looping and branching statements are called control statements because they control the order in which JavaScript programs are run. You can use branching statements ...
Get Coding with JavaScript For Dummies 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.