Stuck with an issue in Java Basics

Stuck with an issue in Java Basics
0

#1

Tell us what’s happening:

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions


#2

What problem has you stuck?


#3

also, don’t put “;” after your if statement.


#4

The instructions don’t give enough information on how to complete it


#5

You have a formatting error here. Make sure brackets are in the proper place


#6

function abTest(a, b) {
// Only change code below this line
if (a<0);
{return undefined;
}
if (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
abTest(2,2);


#7

Again, you should delete you semi colons after the if() if statements should like

if(a < 0) {
  return undefined;
}

or

if(a < 0)
{
  return undefined;
}

Whichever style you like better. Notice there is no “;” after the parenthesis.


#8

oooh I see now. thank you!


#9

Might be other things wrong, but that was the most jarring problem that I saw.