Return undefined,

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”

many thanks for looking.

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 :wink:

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

// Setup
function abTest(a, b) {
  // Only change code below this line
 if (a < 0 && b < 0){
   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

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 to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.