0 of 8 problems solved • 0%
Use in a course

Comparisons and Booleans

8 exercisesEasy

Comparisons turn questions into the boolean values true and false. They let a program ask whether values match, whether one number is larger, or whether several requirements are satisfied.

const age = 19; const hasTicket = true; const canEnter = age >= 18 && hasTicket; console.log(canEnter); // true

Try strict equality (===), ordering comparisons, and the logical operators &&, ||, and !. Prefer comparisons that read like the real rule—the resulting boolean can then drive a decision elsewhere in the program.