I am on the JavaScript challenge “Return Early Pattern For Functions”. Here is my code:
// Setup
function abTest(a, b) {
// Only change code below this line
if (a < 0 || b < 0) {
return;
}
// 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(8,2);
When I press Ctrl + Enter it says you passed but, the console returns “18” and not “undefined”. What did I do wrong?
How can I stop execution after the IF statement?