Tell us what’s happening:
Why is my code not passing the challenge
Your code so far
function bouncer(arr) {
var falsy=[false, "", null, undefined, 0, NaN];
for(var j=0; j<falsy.length; j++){
for(var i=0; i<arr.length; i++){
if(falsy[j]===arr[i]){
let index=arr.indexOf(arr[i]);
arr.splice(index, 1);
}
}
}
return arr
}
console.log(bouncer([false, null, 0, NaN, undefined, ""]));
Your browser information:
User Agent is: Mozilla/5.0 (Linux; U; Android 7.0; TECNO P701 Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/87.0.4280.101 Mobile Safari/537.36 OPR/52.2.2254.54723
.
Challenge: Falsy Bouncer
Link to the challenge: