This is why i love coding

for about 3 hours I have been pounding my head against the wall thinking about how to solve this problem and at the end, I wrote this code it did pass the challenge but after i finished it and i felt relief i thought that would a FALSY value return FALSE ?? which it would so if I just tried to think in another way all I had to do was return arr[i] :sweat_smile: :sweat_smile: :sweat_smile: :sweat_smile:

function bouncer(arr) {

    let result = [];

    for (let i = 0; i < arr.length; i++) {

        if (typeof(arr[i]) !== "boolean" && arr[i] !== "" && arr[i] !== undefined && arr[i] !== 0 && arr[i] !== null && !Number.isNaN(arr[i])) {

          result.push(arr[i]);

        }

    }

    return result;

}

bouncer([7, "ate", "", false, 9]);

Great job working it out. This stuff can be a pain in the butt, but its all worth it when the code works. I think these images will always be relevant
image

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.