# Falsy Bouncer algorithm - any help as to why this solution isn't working? - SOLVED

**URL:** <https://forum.freecodecamp.org/t/falsy-bouncer-algorithm-any-help-as-to-why-this-solution-isnt-working-solved/97124>\
**Category:** General\
**Created:** [March 15, 2017, 11:24pm UTC](https://forum.freecodecamp.org/t/falsy-bouncer-algorithm-any-help-as-to-why-this-solution-isnt-working-solved/97124 "2017-03-15T23:24:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgebo21](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rgebo21](https://forum.freecodecamp.org/u/rgebo21)\
**Post date:** [March 15, 2017, 11:24pm UTC](https://forum.freecodecamp.org/t/falsy-bouncer-algorithm-any-help-as-to-why-this-solution-isnt-working-solved/97124/1 "2017-03-15T23:24:00Z")

</div>

Hi guys,

Working on the falsy bouncer algorithm that removes false values from an array and thought I had made a solution but it doesn’t work with one combination:

solved

This solution is working for the other inputs, but for some reason null is not being removed and I am getting [1,null,2]. Any thoughts on why this is happening? I didn’t exactly use the “hints” they gave me because this jumped into my head as a possible solution immediately.

Thanks a bunch

---

<div class="post-metadata">

**Author:** ![rgebo21](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rgebo21](https://forum.freecodecamp.org/u/rgebo21)\
**Post date:** [March 15, 2017, 11:54pm UTC](https://forum.freecodecamp.org/t/falsy-bouncer-algorithm-any-help-as-to-why-this-solution-isnt-working-solved/97124/3 "2017-03-15T23:54:58Z")

</div>

Weird! When I did that while working on the solution null wasn’t being captured in the switch statement. Now it’s working. There were also some resources that stated null didn’t work in switch statements so I tried the if. Anyways, thanks a bunch!

---

<div class="post-metadata">

**Author:** ![Soupedenuit](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/soupedenuit/32/32478_2.png) [@Soupedenuit](https://forum.freecodecamp.org/u/Soupedenuit)\
**Post date:** [March 16, 2017, 1:34am UTC](https://forum.freecodecamp.org/t/falsy-bouncer-algorithm-any-help-as-to-why-this-solution-isnt-working-solved/97124/4 "2017-03-16T01:34:57Z")

</div>

I don’t see your code. I’m curious to see what you did.  
Here’s mine:

> **Summary**
>
> ```auto
> function bouncer(arr) {
> // Don't show a false ID to this bouncer.
> var check = (x) => Boolean(x);
> return arr.filter(check);
> }
> 
> bouncer([7, "ate", "", false, 9]);
> 
> ```

side note: the arrow function was done afterwards just for kicks. I don’t think the FCC challenges console accepts them.

---

<div class="post-metadata">

**Author:** ![Soupedenuit](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/soupedenuit/32/32478_2.png) [@Soupedenuit](https://forum.freecodecamp.org/u/Soupedenuit)\
**Post date:** [March 16, 2017, 4:22pm UTC](https://forum.freecodecamp.org/t/falsy-bouncer-algorithm-any-help-as-to-why-this-solution-isnt-working-solved/97124/6 "2017-03-16T16:22:58Z")

</div>

Wow, that’s amazingly simple!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 9:43am UTC](https://forum.freecodecamp.org/t/falsy-bouncer-algorithm-any-help-as-to-why-this-solution-isnt-working-solved/97124/7 "2021-01-17T09:43:01Z")

</div>

Closed on January 17, 2021, 9:43am UTC


