Boolean Data Type
The boolean data type is a data type that can have one of two values: true or false. These values represent the state of truth or falsity of a statement or condition.
True and False Values
A value is considered “truthy” if it evaluates to true when coerced into a boolean. On the other hand, a value is considered “falsy” if it evaluates to false.
"" (empty string)
Boolean Methods and Operators
Some of the commonly used methods include:
.toString(): Converts a boolean value to its string representation.
.valueOf(): Returns the primitive value of a boolean object.
Some of the commonly used operators include:
!(Logical NOT): Negates a boolean value.
&&(Logical AND): Returns true if both operands are true, otherwise returns false.
||(Logical OR): Returns true if at least one of the operands is true, otherwise returns false.