function sum(num1, num2){
if(num1 == undefined || num2 == undefined){
throw {
errMsg: "能不能好好玩耍了,乖乖给我传参!!",
errCode: 13888888888
};
}else{
return num1 + num2;
}
}
// sum(0);
try{
sum(0);
}
catch(e){
console.log(e.errMsg);
}
转载于:https://www.cnblogs.com/vzaiBoke/p/9102296.html