Hello, I run the code in my browse console, it renturns the [NaN], does the NaN belong to the falsy? Is something wrong in my code? Could someone help me?
Your code so far
function bouncer(arr) {
var falsy=[false, null, 0, "", undefined, NaN];
var newArr=[];
// Don't show a false ID to this bouncer.
for (var i=0; i<arr.length; i++){
if(falsy.indexOf(arr[i])===-1){newArr.push(arr[i])
}
}
return newArr;
}
bouncer([false, null, 0, NaN, undefined, ""]);
[NaN]
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.26 Safari/537.36 Core/1.63.5712.400 QQBrowser/10.2.1957.400
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer/