Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 481 Bytes

truthiness-of-integer-arrays.md

File metadata and controls

28 lines (22 loc) · 481 Bytes

Truthiness of Integer Arrays

We can consider the truthiness of [1] as follows:

> [1] == true
=> true
> Boolean(true)
=> true
> Boolean([1])
=> true

We can consider the truthiness of [0] as follows:

> [0] == false
=> true
> Boolean(false)
=> false
> Boolean([0])
=> true

The truthiness of [0] does not seem to be consistent.

See this JavaScript Equality Table for more details.