throw和throw new之间有什么区别错误,我有点困惑似乎只使用throw关键字创建了一个Error对象,那么为什么新的Error与throw一起使用? 示例
try{
throw "something went wrong";//this works
}
catch(e){
console.log(e);
}
try{
throw new Error("something went wrong");//this also works but with
// longer syntax
}
catch(e){
console.log(e);
}