Implement a Falsy Remover - Implement a Falsy Remover

Tell us what’s happening:

Hey, my code does not pass test -
6. The bouncer function should not mutate the array passed in as argument.
But it works fine on the console.

Your code so far

function bouncer(arr) {
  let result = [];

  for(let i = 0; i < arr.length; i++) {
    let ifFalse = arr[i] === 0 ||
      arr[i] === false
      || arr[i] === null
      || arr[i] === ""
      || arr[i] === undefined
      || Number.isNaN(arr[i]);

    if(ifFalse) {
        delete arr[i];
      } else {
        result.push(arr[i]);
      }

  }
  return result;
}

const testArr = bouncer(["I like pauline", 25, NaN, true, false, "", null, undefined]);
console.log(testArr);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Implement a Falsy Remover - Implement a Falsy Remover

What does it mean by “should not mutate the array passed in as argument” ?

I know it against me using the “delete” but how else I’m I to make it work if not

Can you please explain what that line of code does? (or more importantly, why)

you are doing this, aren’t you? why you need to delete the others?