Hello fellow campers,
I would like to find out the difference between the following codes , thank you!:
//This is my code which is wrong because it does not satisfy : abTest(-2,2) should return undefined
function abTest(a, b) {
// Only change code below this line
if (a < 0, b < 0 ) // HOW IS THIS LINE BEING INTERPRETED W/ A COMMA INSTEAD OF A "||"
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);
// SPOILER ALERT
// This is the right code
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
abTest(2,2);