In some languages (e.g. C), the boolean values are defined as actual numerical values, so they are just different names for
1 and 0 (or -1 and 0).
In some other languages (e.g.
Java),treats boolean
as a
completely separate data type which has 2 distinct values: true and false.
The values 1 and 0 are of type int and are not implicitly convertible
to boolean
.
Javascript falls in the category that has a distinct boolean type, but on the other hand Javascript is quite keen to convert values
between different data types.