# Test Cases For Drop It

**URL:** <https://forum.freecodecamp.org/t/test-cases-for-drop-it/179913>\
**Category:** General\
**Created:** [March 15, 2018, 6:52pm UTC](https://forum.freecodecamp.org/t/test-cases-for-drop-it/179913 "2018-03-15T18:52:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cthorpe1](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@cthorpe1](https://forum.freecodecamp.org/u/cthorpe1)\
**Post date:** [March 15, 2018, 6:52pm UTC](https://forum.freecodecamp.org/t/test-cases-for-drop-it/179913/1 "2018-03-15T18:52:34Z")

</div>

Hello,

I have a question regarding the “Drop It” challenge in Intermediate Algorithm section.

My code currently passes all test cases except two.  
First: dropElements([0, 1, 0, 1], function(n) {return n === 1;}) should return [1, 0, 1].  
Second: dropElements([1, 2, 3, 9, 2], function(n) {return n \> 2;}) should return [3, 9, 2].

My question is: how will n === 1 ever evaluate to true when n=0? This seems to be impossible to me. The same is true for n \> 2 when n=2. The check is NOT for n \>= 2, it is n \> 2. Therefore, my code (see below) should work.

For some reason, if I copy and paste the basic solution in, all the tests pass. But how does “0 === 1” or “2 \> 2” ever evaluate to true? Thank you for your help guys.

**My Code:**

```auto
function dropElements(arr, func) {
  // Drop them elements.
  var newArray = arr.filter(func);
  return newArr;
}

dropElements([1, 2, 3], function(n) {return n < 3; });

```

---

<div class="post-metadata">

**Author:** ![cthorpe1](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@cthorpe1](https://forum.freecodecamp.org/u/cthorpe1)\
**Post date:** [March 15, 2018, 6:55pm UTC](https://forum.freecodecamp.org/t/test-cases-for-drop-it/179913/2 "2018-03-15T18:55:05Z")

</div>

Please disregard, I re read the instructions and realized that we are not supposed to evaluate each item in the array, only until we find the first true case. Sorry for the needless forum post.

---

<div class="post-metadata">

**Author:** ![ArielLeslie](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/arielleslie/32/264841_2.png) [@ArielLeslie](https://forum.freecodecamp.org/u/ArielLeslie)\
**Post date:** [March 15, 2018, 7:03pm UTC](https://forum.freecodecamp.org/t/test-cases-for-drop-it/179913/3 "2018-03-15T19:03:09Z")

</div>

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See [this post](http://forum.freecodecamp.com/t/forum-code-formatting/25574) to find the backtick on your keyboard. The “preformatted text” tool in the editor (`</>`) will also add backticks around text.

![markdown_Forums](https://sea3.discourse-cdn.com/freecodecamp/uploads/default/original/3X/4/b/4b9a26f0c243380dd84935f4e29b92e3ecee8d05.gif)

---

<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 16, 2021, 6:35pm UTC](https://forum.freecodecamp.org/t/test-cases-for-drop-it/179913/4 "2021-01-16T18:35:55Z")

</div>

Closed on January 16, 2021, 6:35pm UTC


