Class: boolean

boolean

This primitive type can hold only one of two values: true or false. Booleans are the result of most logical operations such as greater than (>) or strict equals (===). The && and || operators do not necessarily return a boolean, but instead return one of the two operands. However, any type will be automatically converted to boolean when used in control flow statements such as 'if' and 'while.'

Values that are converted to false include 0, null, undefined, and empty Strings. Any other value, including empty Arrays, evaluates to true.

Primitive types are passed by value and not reference.