设置当函数值不符合要求时抛出错误
function add(a, b = 1) {
if (a == 0) {
throw new Errow('A is Error')
}
return a + b
}
console.log(add(0))
结果
设置当函数值不符合要求时抛出错误
function add(a, b = 1) {
if (a == 0) {
throw new Errow('A is Error')
}
return a + b
}
console.log(add(0))
结果