Created
September 19, 2018 02:04
-
-
Save kimili/40e8931fb66774d79fa21193630c49e1 to your computer and use it in GitHub Desktop.
JavaScript Compact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compact = arr => arr.filter(Boolean); | |
compact([1, false, 2, '', 3, null, 'abc']); // [1, 2, 3, 'abc'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment