function isTrue(value) {
return value != false && isNaN(value) === false && value !== null;
}
function bouncer(arr) {
// Don't show a false ID to this bouncer.
arr = arr.filter(isTrue);
return arr;
}
bouncer(["a", "b", "c"]);
I can’t figure out why my code is removing strings from the array. From what I can tell, strings are not equal to false, NaN or null.
Ah that totally understand what you’re saying. When I began the problem that’s what I was trying to get at, but couldn’t really put it into code. Thank you.