Created
June 15, 2016 04:55
-
-
Save MohammedAhmed49/1e999f4c61d977e839d033070c36cbf4 to your computer and use it in GitHub Desktop.
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 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