Skip to content

Instantly share code, notes, and snippets.

@kaizer1v
Created September 21, 2018 07:32
Show Gist options
  • Save kaizer1v/97f8ff69162bc4ec4a4bc9a1b2be50b9 to your computer and use it in GitHub Desktop.
Save kaizer1v/97f8ff69162bc4ec4a4bc9a1b2be50b9 to your computer and use it in GitHub Desktop.
filterBoolean
// filters out all the falsey values and returns only valid ones
let arr = [7, "ate", "", false, 9];
arr.filter(Boolean); // [7, 'ate', 9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment