false value
The false value means false. It
can be used in conditionals with
if
and elseif
to test them for truth, as well as
to determine the presence of an
element or property.
Syntax
false;
Example
Let's check if the array contains
the letter 'e':
let arr = ['a', 'b', 'c', 'd'];
console.log(arr.includes('e'));
The code execution result:
false
Example
Let's check if a value of the
variable is equal to 2:
let num = 1;
console.log(num === 2);
The code execution result:
false
Example
Let's check the result of the condition:
let test = false;
if(test === false) {
console.log('+++');
} else {
console.log('---');
}
The code execution result:
'+++'