Very often, in programming, you will need a data type that can only have one of two values, like
You can use the Boolean() function to find out if an expression (or a variable) is true:
Or even easier:
The chapter JS comparisons gives a full overview of comparison operators.
The chapter JS conditions gives a full overview of conditional statements.
Here are some examples:
|==||equal to||if (day == "Monday")|
|>||greater than||if (salary > 9000)|
|<||less than||if (age < 18)|
Primitive values, like true and false, cannot have properties or methods (because they are not objects).
The reference contains descriptions and examples of all Boolean properties and methods.