Tell us what’s happening:
my display return NaN instead of undefined in the console. should i use another method? my case is wrong?
Your code so far
// Setup
function abTest(a, b) {
// Only change code below this line
switch(a,b){
case a, b < 0:
return undefined ;
}
// Only change code above this line
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}
console.log(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/114.0.0.0 Safari/537.36 OPR/100.0.0.0
Challenge: Basic JavaScript - Return Early Pattern for Functions
Link to the challenge: