30 seconds of code

  Back to Home

filterFalsy

arraybeginner

Filters out the falsy values in an array.

Use Array.prototype.filter() to get an array containing only truthy values.

const filterFalsy = arr => arr.filter(Boolean);