vexi.js.Boolean - Booleans

A simple true or false value.

A boolean is a primitive, so all string functions are valid.

Boolean evaluation as false

The following values equate to false when considered as an expression (e.g. if) result:

For example:

 if (0) {
     // not reached
 }

Boolean evaluation as true

The following values equate to true when used in expressions:

For example:

 if ("abc") {
     // reached
 }

Boolean evaluation as equals

However, when used in boolean operations as part of the equals (==) operator, values that equate to false or true when used in an expression will not usually be considered equal.

The exception to this is 0 as false is internally stored as a '0', thus 0 == false evaluates to true.

Consider:

 if (null == false) {
     // not reached
 }

 if ("abc" == true) {
     // not reached
 }

 


Copyright © 2011 The Vexi Project (vexi.sourceforge.net)