# Return undefined,

**URL:** <https://forum.freecodecamp.org/t/return-undefined/161390>\
**Category:** General\
**Created:** [November 29, 2017, 7:57am UTC](https://forum.freecodecamp.org/t/return-undefined/161390 "2017-11-29T07:57:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robg](https://avatars.discourse-cdn.com/v4/letter/r/a698b9/32.png) [@Robg](https://forum.freecodecamp.org/u/Robg)\
**Post date:** [November 29, 2017, 7:57am UTC](https://forum.freecodecamp.org/t/return-undefined/161390/1 "2017-11-29T07:57:32Z")

</div>

Please see the screenshot, does anyone know what’s wrong with the code? been on this all morning and only getting partial bits right…“undefined” does not appear but it shows green anyway?? and with other numbers nothing appears at all unless I take away my code “return”

 ![codecampjv](https://global.discourse-cdn.com/freecodecamp/original/3X/f/d/fd284c3af4b9404e918b4fa15415707035d680a1.PNG)

many thanks for looking.

---

<div class="post-metadata">

**Author:** ![kevcomedia](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevcomedia/32/125737_2.png) [@kevcomedia](https://forum.freecodecamp.org/u/kevcomedia)\
**Post date:** [November 29, 2017, 8:00am UTC](https://forum.freecodecamp.org/t/return-undefined/161390/2 "2017-11-29T08:00:53Z")

</div>

There’s a semicolon after the if’s condition. This separates the `if` from the block after it, so that block always gets executed.

Next time, please paste the code and the challenge name (and preferrable a link to the challenge) instead of a screenshot, so it’s easier for others to play with the code 😉

---

<div class="post-metadata">

**Author:** ![Robg](https://avatars.discourse-cdn.com/v4/letter/r/a698b9/32.png) [@Robg](https://forum.freecodecamp.org/u/Robg)\
**Post date:** [November 29, 2017, 8:12am UTC](https://forum.freecodecamp.org/t/return-undefined/161390/3 "2017-11-29T08:12:40Z")

</div>

Hi thanks for reply,  
took away the semicolon and it changed the green to red and the red to green.

Return Early Pattern for Functions

```auto
// Setup
function abTest(a, b) {
  // Only change code below this line
  
 if (a < 0 && b < 0){
  console.log("undefined");
   return undefined;
  }
   // Only change code above this line

  return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(-2,2);

```

---

<div class="post-metadata">

**Author:** ![kevcomedia](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevcomedia/32/125737_2.png) [@kevcomedia](https://forum.freecodecamp.org/u/kevcomedia)\
**Post date:** [November 29, 2017, 8:17am UTC](https://forum.freecodecamp.org/t/return-undefined/161390/4 "2017-11-29T08:17:56Z")

</div>

You’re close to getting it! Just read the problem again carefully and think about what needs to change in your code.

I’ve also edited your post for readability. When you enter a code block into the forum, remember to 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 17, 2021, 8:33pm UTC](https://forum.freecodecamp.org/t/return-undefined/161390/5 "2021-01-17T20:33:39Z")

</div>

Closed on January 17, 2021, 8:33pm UTC


