9.19 Comparison Operators and Logical Operators

We’re not done with the improved Water Balloons web page. We still need to present its calculateWater function, which checks for valid input and calculates the number of gallons of water needed to fill up the balloons. But all that checking and calculating uses Java Script operators that haven’t been introduced, or they’ve been introduced but not described fully. So in this section, we’ll take a little side trip where you learn about those operators, and in the next section, we’ll use those operators in implementing the calculateWater function.

Comparison Operators

As you know, an if statement’s heading includes a condition with parentheses around the condition, like this:

if (condition) { ...

Get Web Programming with HTML5, CSS, and JavaScript 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.