So when I run this code with an array containing null statement, it fails to filter out the null. What confuses me is that if I run the code with an array that only contains null statements, even multiple nulls, then the code does filter out all of the nulls. Why does this code fail? Why does it work when there are only nulls?
Your code so far
function bouncer(arr) {
// Don't show a false ID to this bouncer.
var newArr = arr.filter(function(i){
switch(i){
case(false):
case(null):
case(0):
case(""):
case(undefined):
case(NaN):
return false;
default:
return true;
}
});
return newArr;
}
bouncer([1, null, NaN, 2, undefined]);```
**Your browser information:**
Your Browser User Agent is: ```Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36```.
**Link to the challenge:**
https://www.freecodecamp.org/challenges/falsy-bouncer