arr.filter(item=>item) will filter each item by its own “truthiness” value. So if an item is 0, empty, false, or any other “falsy” value, it will not pass the filter criterion, and thus not be included in the output.
Let’s go into a long-form explanation for posterity: The Array.filter method is given a callback function, i.e.
arr.filter(some_func_returning_true_or_false)
In this case, imagine a function called identity that just takes a value and returns it. Doesn’t seem useful by itself, but wait for it:
function identity(x) { return x; }
So now you have this:
arr.filter(identity)
If you treat it as a function returning true or false values, any value in that’s false (“falsey” actually, as explained in the challenge) will return itself, and therefore a false value.
A shorter version of this, as an expression, is just x => x. So now you have this expression:
arr.filter(x => x)
Which should do the same as the longer version using identity. For each value in the array, it’s passed to the callback function, and if it returns false, it is omitted from the return value.