This works because Boolean(val) is roughly equivalent to val => !!val. That is, it's a function that coerces a value into a Boolean.
You have just read Filtering out falsy values, written on August 28, 2016. This is Today I Learned, a collection of random tidbits I've learned through my day-to-day web development work. I'm Rico Sta. Cruz, @rstacruz on GitHub (and Twitter!).