Basic Algorithm Scripting - Falsy Bouncer

I dont really understand this solution and hoping for some clarification.

The task: Remove all falsy values from an array. Return a new array; do not mutate the original array.

I dont understand how this solution identifies what is a falsy value. Wouldn’t this solution just push every array element, regardless if it is falsy or not?

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

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0

Challenge: Basic Algorithm Scripting - Falsy Bouncer

Link to the challenge:

What do you suppose this condition means?

Its easier to talk about this solution if we compare it to what you wrote.

if (arr[i]) == if there’s an array element.

Are you suggesting that in the followingArray[0, 1, false, null, 3, 4] that followingArray[4] doesnt exist?

No, not quite.

It is not checking if the array element exists. It is checking if the array value is equivalent to true.

Again, it is easier to explain if you share the solution you wrote.

I shared the solution I wrote in the original post.

You wrote it without knowing how it works at all? Impressive and bizzare

Also surprising that it exactly matches the posted solution in the guide (well, matches before I made some minor updates today).

Whats so impressive and bizarre about me questioning the posted solution in the guide?

I started this post because the answer makes no sense to me. What is the problem?

So this is not the solution you wrote?

As I have been saying, it is easier to explain a guide solution if we compare it to the solution you wrote before you copied this from the guide.

I never wrote a solution. I have no idea how to isolate falsy values. And the posted solution has not made it any clearer.

I would completely ignore the solution then.

It is best to look at the posted solutions after you write your own solution. The more you look up solutions, the less you will be able to write your own solutions.

This is a pretty big hint:

Hint: Try converting each value to a Boolean.

Do you know how to convert a value to a boolean?

I appreciate your passive aggressiveness more than you’ll ever appreciate. Which part of the posted solution converted each value to a boolean?

I am being direct. I’m asking questions and replying based upon the information you give.

Again, ignore the written solution. Copying answers cripples your ability to create your own code. There are not answers to copy for the certification projects (unless you cheat, which will result in your certification being revoked).

Do you know how to convert a value to a boolean? There are many ways to do this. The written solution uses one (again, ignore it for now), but there are many more. Understanding how to treat a value as a boolean is the entire point of this challenge.

If you can write at least one way of converting a value into a boolean, then you can write a solution to this challenge.

youre fired, goodbye