Hello guys!
I have solved this problem using if statement. However I just had a thought if we can also do it using.. Switch statement ?
// 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));
abTest(0,0);
}
I tried and 4 cases are working..2 cases are not working. Can any one help me do this ?
Switch statement:
// Setup
function abTest(a, b) {
// Only change code below this line
switch (a,b){
case a,b<0:
return undefined;
break;
}
// Only change code above this line
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
abTest(0,0);
}
If I’m doing any wrong correct me please!! Thank you!