Filtering falsy values
How to quickly discard falsy values from an array
March 22, 2017
-
1 minute read
-
How to quickly discard falsy values from an array? Thanks to
Array.filter(Boolean), this is an easy task.
This works because Boolean(val) is a function that coerces a value into a Boolean.