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
What problem has you stuck?
also, don’t put “;” after your if statement.
The instructions don’t give enough information on how to complete it
You have a formatting error here. Make sure brackets are in the proper place
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);
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.
oooh I see now. thank you!
Might be other things wrong, but that was the most jarring problem that I saw.