Tell us what’s happening:
I can’t get Nan removed from the array . Help!
Your code so far
function bouncer(a) {
// Don't show a false ID to this bouncer.
let h = [];
let s = [];
for(let i = 0; i < a.length; i++){
if(a[i] == false || a[i] == null || a[i] == 0|| a[i] == ""|| a[i] == undefined){
h.push(i);
}
}
for(let j = (h.length)-1; j >= 0; j--){
a.splice(h[j],1);
}
console.log(a);
}
bouncer([7, "ate", "", false, 9]);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer/