Falsy Bouncer | Got the answer right, but no idea why

Caution: Answer to Falcy Bouncer Ahead!

Can someone explain simply the logic behind my answer?

Thank you.

Remove all falsy values from an array.

Falsy values in JavaScript are false, null, 0, “”, undefined, and NaN.

function bouncer(arr) {
  var x = arr.filter(function(re){
 return re;


  return x;
bouncer([[7, "ate", 9]]);

The reason it works is because each value in JavaScript has a boolean value, even if it’s not true or false. We consider that “truthy” or “falsy” values. Falsy values you listed already, everything else would be evaluated as truthy. All your callback function is doing is returning the value it was passed, so filter evaluates that value’s “truthiness” and determines if they get included in the new array that the filter function returns.