CHAPTER 6

image

JavaScript Control Statements Reference

Introduction

As we discussed in Chapter 2, JavaScript has the usual control statements you would expect for a C-like language:

  • do loops
  • for and for/in loops
  • while loops
  • if-else conditionals
  • switch conditionals

In addition, JavaScript provides ways to manage your loop iterations, break out of loops entirely, and even limit the scope of your loops.

In this chapter we’ll provide a solid reference for all JavaScript control statements, in alphabetical order. For detailed discussions of these statements, see Chapter 2.

break

The break statement terminates the current loop or the current label or ...

Get JavaScript Programmer's Reference 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.