Conditions with boolean values in JavaScript
Suppose we have some variable that can
take the values true
or false
:
let test = true;
Let's write if
that tests our variable
for the value true
:
let test = true;
if (test === true) {
console.log('+++');
} else {
console.log('---');
}
Check that the variable test
is equal to true
.
Check that the variable test
is equal to false
.