Hour 6. Scripts That Do More

What You’ll Learn in This Hour

• Using conditional statements

• Comparing values with comparison operators

• Applying logical operators

• Writing loops and control structures

• Debugging your scripts

In the last hour of Part I you took a quick trip through the data types that JavaScript variables can contain. To create anything but the simplest scripts, though, you’re going to need your code to make decisions based on those values. In this hour we examine ways to recognize particular conditions and have our program act in a prescribed way as a result.

You also learn how to use browser-based tools to help debug these more complex JavaScript programs.

Conditional Statements

Conditional statements, as the name implies, ...

Get Sams Teach Yourself JavaScript™ in 24 Hours, Fifth Edition 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.