Skip to content

Instantly share code, notes, and snippets.

@MohammedAhmed49
Created June 15, 2016 04:55
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 MohammedAhmed49/1e999f4c61d977e839d033070c36cbf4 to your computer and use it in GitHub Desktop.
Save MohammedAhmed49/1e999f4c61d977e839d033070c36cbf4 to your computer and use it in GitHub Desktop.
function filt(val) {
if((val === false)||(val === null)||(val === 0)||(val === "")||(val === undefined)||(val === NaN)) {
return false;
}
return true;
}
function bouncer(arr) {
// Don't show a false ID to this bouncer.
var ar = arr.filter(filt);
return ar;
}
bouncer([1, null, NaN, 2, undefined]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment