# Finders Keepers Bug

**URL:** <https://forum.freecodecamp.org/t/finders-keepers-bug/245131>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [December 11, 2018, 7:28pm UTC](https://forum.freecodecamp.org/t/finders-keepers-bug/245131 "2018-12-11T19:28:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Therion85](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@Therion85](https://forum.freecodecamp.org/u/Therion85)\
**Post date:** [December 11, 2018, 7:28pm UTC](https://forum.freecodecamp.org/t/finders-keepers-bug/245131/1 "2018-12-11T19:28:09Z")

</div>

My code:

```auto

function findElement(arr, func) {

  let num = 0;

  for (let i = 0; i < arr.length; i++) {

    num = arr[i];

    if (func(num)) {
      return num
    };

  };

      return 'undefined';
};

findElement([1, 2, 3, 4], num => num % 2 === 0);

```

With the above code, the following criteria for the exercise is not met: “findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })` should return undefined”

However when i run the function with that array and log the results to the console it does in fact return undefined.

Bug in the exercise??

**Your browser information:**

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36`.

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [December 11, 2018, 7:40pm UTC](https://forum.freecodecamp.org/t/finders-keepers-bug/245131/2 "2018-12-11T19:40:22Z")

</div>

Remove the quotes around ‘undefined’.

---

<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:** [December 11, 2018, 7:57pm UTC](https://forum.freecodecamp.org/t/finders-keepers-bug/245131/3 "2018-12-11T19:57:49Z")

</div>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate 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.

**Note:** Backticks are not single quotes.

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

---

<div class="post-metadata">

**Author:** ![Therion85](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@Therion85](https://forum.freecodecamp.org/u/Therion85)\
**Post date:** [December 11, 2018, 8:40pm UTC](https://forum.freecodecamp.org/t/finders-keepers-bug/245131/5 "2018-12-11T20:40:35Z")

</div>

Ah ok I skimmed over that part. Thanks for editing.

---

<div class="post-metadata">

**Author:** ![Therion85](https://avatars.discourse-cdn.com/v4/letter/t/e47774/32.png) [@Therion85](https://forum.freecodecamp.org/u/Therion85)\
**Post date:** [December 11, 2018, 8:41pm UTC](https://forum.freecodecamp.org/t/finders-keepers-bug/245131/6 "2018-12-11T20:41:35Z")

</div>

Yep, that works. Thanks!!

---

<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:** [February 2, 2021, 11:23am UTC](https://forum.freecodecamp.org/t/finders-keepers-bug/245131/7 "2021-02-02T11:23:35Z")

</div>

Closed on February 2, 2021, 11:23am UTC


