Skip to content

Instantly share code, notes, and snippets.

@alchermd
Last active June 29, 2016 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alchermd/40ec4a994276e28874dad3c12d0e9c9d to your computer and use it in GitHub Desktop.
Save alchermd/40ec4a994276e28874dad3c12d0e9c9d to your computer and use it in GitHub Desktop.
function bouncer(arr) {
// Don't show a false ID to this bouncer
bad = [false, null, 0, "", undefined, NaN];
waku = arr.filter(function(x) {
return bad.indexOf(x) == -1;
});
return waku;
}
bouncer([1, null, NaN, 2, undefined]); //returns [1,null,2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment