Implement a Falsy Remover - Implement a Falsy Remover

Tell us what’s happening:

I know that changing my If statement (let i = 0;…) with (x of array) it will work.

But, Why it doesn 't work, if the value is the same (x / array[i])?

Your code so far

function bouncer(arr) {
    let newArr = [];
    for (let i = 0; i < arr; i++) {
        if (arr[i]) {
          newArr.push(arr[i]);
        }
    }
    return newArr;
};


Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0

Challenge Information:

Implement a Falsy Remover - Implement a Falsy Remover

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-falsy-remover/adf08ec01beb4f99fc7a68f2.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @tlcybdib0

What does arr represent here?

Happy coding

I got it. Thanks!! :+1: