Return Early Pattern for Functions (I AM STUCK)

Tell us what’s happening:

Your code so far

// 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
console.log(abTest(-1, 0))

The above code was used to solve this problem
" Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined .
Remember that undefined is a keyword, not a string".

from this link

yet its still failing even after making it undefined from my code

please help me out, i am stucked…

thanks do much

The clue is in the hint that undefined is not a string

1 Like

undefined is not a string.

“I am a string because I am in quotes”.

1 Like

Thanks guys
this is it

 if (a < 0 || b < 0)
  return ;

I have gotten it