Booleans

The Boolean type has two values, true and false. Comparisons (<, ===, in, instanceof; see Operators) produce them, and every if, while, ? : and logical operator converts its operand to one. Because that conversion accepts any value, JavaScript code relies heavily on truthiness, which is where most Boolean bugs hide.

Subsections