Not able to figure out what method to use. case? or setting an if else?
Your code so far
// Setup
function abTest(a, b) {
// Only change code below this line
// 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);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36.
Hey ShazzyDigital how u r doin? So basically when use return statement inside function javascript engine that execute code inside function body execute all the codes till return when it sees return it stops there and give back or return whatever expression or code it sees in return from that function and it does not execute any code after return statement. This is what asked in challenge. Return early state of for function exit. So that’s why you did not see code with Math.methods().
As a side note, you can also use ternary for stuff like this i.e. when a function is going to return something based on one condition, rather than having: