function bouncer(array){
let copy = array.slice();
let newArray = copy.filter(copy => Boolean);
for (let i=0; i<newArray.length; i++){
if (newArray[i] === false && newArray[i]===NaN){
delete newArray[i];
}
}
return newArray;
}
console.log(bouncer([7, "ate", "", false, 9]));
Good morning from France coders!! (It’s 10AM over here)
This code removes the falsy values but not the elements themselves. It leaves me with empty slots in my newArray. How can I get rid of those?
Thank you
Happy Coding
Mike
PS: I’m aware the NaN part doesn’t work either, I’ll tackle it next