1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 23:28:02 +00:00
Files
til/javascript/truthiness-of-integer-arrays.md

481 B

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.