Making a decision
An if statement runs a block of code only when a condition is true. You write if, a condition in parentheses, and the code to run in curly braces:
if (condition) {
// runs only when condition is true
}Comparison operators
Conditions are usually comparisons that come out true or false. The operators are:
a < b— less thana > b— greater thana <= b— less than or equal toa >= b— greater than or equal toa === b— equal to (three equals signs!)a !== b— not equal to
Use ===, not =
A single = assigns a value; three of them === compares. To test if score is 10, write if (score === 10).
Try changing 7 to 3 and press Run — now the condition is false, so the circle never appears.