JavaScript中的“ throw new Error”和“ throw someObject”之间有什么区别?
javascript中“ throw new Error”和“ throw someObject”之间的区别在于throw new Error以以下格式包装传递给它的错误-
{name: 'Error',
message: 'Whatever you pass in the constructor'
}
throw someObject将按原样抛出对象,并且将不允许从try块执行任何进一步的代码,即与throw new Error相同。
以上是 JavaScript中的“ throw new Error”和“ throw someObject”之间有什么区别? 的全部内容, 来源链接: utcz.com/z/353479.html