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 ...
Don’t forget to visit the website to check out the online exercises relevant to this chapter!