Truthiness of Integer Arrays
We can consider the truthiness of [1] as follows:
> [1] == true
=> true
> Boolean(true)
=> true
> Boolean([1])
=> trueWe can consider the truthiness of [0] as follows:
> [0] == false
=> true
> Boolean(false)
=> false
> Boolean([0])
=> trueThe truthiness of [0] does not seem to be consistent.
See this JavaScript Equality Table for more details.
Last updated
Was this helpful?