O'Reilly logo

JavaScript by Example, Second Edition by Ellie Quigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Under Certain Conditions

image

6.1 Control Structures, Blocks, and Compound Statements

If you were confronted with the above signpost, you’d have to decide which direction to take. People control their lives by making decisions, and so do programs. In fact, according to computer science books, a good language allows you to control the flow of your program in three ways. It lets you

• Execute a sequence of statements.

• Branch to an alternative sequence of statements, based on a test.

• Repeat a sequence of statements until some condition is met.

Well, then JavaScript must be a good language. We’ve already used programs that execute a sequence ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required