不断出现 Uncaught SyntaxError: Missing catch or finally after try
为什么这是错误的?
function areBothTrue(bool1, bool2) {
`return bool1 && bool2;`
}
}
console.log(areBothTrue(true, false), '<-- should be false');
console.log(areBothTrue(true, true), '<-- should be true');
最佳答案
您的代码不完整。并且不需要使用`。
这是正确的命令
function areBothTrue(bool1, bool2) {
if (bool1 && bool2){
return true
}
else{
return false
}
}
console.log(areBothTrue(true, false), '<-- should be false');
console.log(areBothTrue(true, true), '<-- should be true');
关于javascript - 修改函数,如果两个参数都为 true,则返回 true,否则返回 false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55621330/