Please enable JavaScript to use CodeHS

Chapter 2

JavaScript Control Structures

2.4 If Statements

Negative Numbers

If/Else Statements

Even and Odd

Secret Password

Check Your Understanding

  1. Incorrect Correct No Answer was selected Invalid Answer

Exercise: Ride Height


Term Definition
Condition A condition is code that you put inside an if statement or while-loop.
If Statement An if statement lets you ask a question to the program and only run code if the answer is true.
Control Structure A control structure lets us change the flow of the code.
Parentheses ( and )