When I run my code, every case is right but Nan is not right. What happen to this case?
Please help! I’m stuck here.
Thanks!
Your code so far
function bouncer(arr) {
// Don't show a false ID to this bouncer.
let falsyArr = [false, null, 0, "", undefined, NaN];
let temp = [];
for(let i = 0; i < arr.length; i++){
if(falsyArr.indexOf(arr[i]) < 0){
temp.push(arr[i]);
}
}
return temp;
}
bouncer([false, null, 0, NaN, undefined, ""]);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer