codecamp

JavaScript 在函数中使用return跳出函数

// Setup
function abTest(a, b) {
// Only change code below this line
if(a<0){
  return undefined;
}
else if(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);
JavaScript 直接在函数中返回boolean值
JavaScript 条件判断算法综合实战
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定