Tell us what’s happening:
I’ve got most of the tests passing, but I’m still stuck on test 2 and test 3.
Test 2: bouncer([7, “ate”, “”, false, 9]) should return [7, “ate”, 9], but my code only gives [7, 9].
Test 3: bouncer([“a”, “b”, “c”]) should return [“a”, “b”, “c”], but mine comes back as .
Not quite sure where I’m going wrong here — any tips?
Your code so far
let newArray = [];
const bouncer = (array) => {
array.forEach((arrEl) => {
if (
arrEl !== false &&
arrEl !== null &&
arrEl !== 0 &&
arrEl !== "" &&
arrEl !== undefined &&
!isNaN(arrEl)
) {
newArray.push(arrEl);
}
});
return newArray;
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0
Challenge Information:
Implement a Falsy Remover - Implement a Falsy Remover
https://www.freecodecamp.org/learn/full-stack-developer/lab-falsy-remover/implement-a-falsy-remover