Last active
December 26, 2017 19:13
-
-
Save AviTapp/de1aeda9264eeeb26fb6f8d0fe8a4fdd to your computer and use it in GitHub Desktop.
Remove all falsy values from an array.
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
function bouncer(n) { | |
return n = n.filter(function(n) { | |
var r = [!1, null, 0, "", void 0, NaN]; | |
for (i = 0; i < r.length; i++) return n != r[i] ? n : void 0 | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment