5. Using Control Structures
Programming is a matter of taking actions with data. The previous chapter introduced the basics of data—simple variables—and this chapter covers the information you need to know in order to dynamically take action. Primarily consisting of conditionals and loops, control structures are a programmatic way to either execute statements only under certain situations or to execute statements repeatedly for a certain number of times. Along the way, you’ll learn most of JavaScript’s remaining operators. (Chapter 2, JavaScript in Action, snuck in a couple of conditionals and operators, but this chapter teaches the bulk of them in full detail.)
Basics of Conditionals
JavaScript has the standard conditionals that exist in most ...
Get Modern JavaScript: Develop and Design 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.