Falsy Bouncer with => and Array of Falsy Values

I’ve created an array of the falsy values called array.

I want to make use of it instead of doing return arr.filter( (x) => x) or return arr.filter(Boolean).

Those are really concise methods, but I don’t understand them.

I’ve tried:

return arr.filter( (x) => !falsy.includes(x))

to no avail.

It doesn’t work like that. Falsy values have some interesting behaviours, for example NaN === NaN will always be false

Falsy values has this property that when evaluated as a Boolean, they are false. This is what you should use to pass this challenge

For example Boolean(NaN) returns false, same for all the others falsy values

Actually my solution did work. However, I messed up on the function call when I copied the contents over, and it was passing a string.

However, I now have a better grasp of why Boolean works.

Thank you.