Boolean
The boolean type has only two values: true and false. They are often used in conditions and logical operations.
let isLogged = true;let isReady = false;Booleans result from comparisons:
console.log(5 > 3); // trueconsole.log(5 === 3); // falseThey can also be created with the Boolean function or double NOT (!!):
console.log(Boolean(0)); // falseconsole.log(Boolean("hello")); // trueconsole.log(!!"hello"); // trueFalsy values (evaluate to false): false, 0, ” (empty string), null, undefined, NaN. Everything else is truthy.