The ES5 language specification clearly indicates that Error(foo) does the same as new Error(foo) .
But I notice that in the wild, the longer form new Error(foo) much more common.
Is there a reason for this?
Is there a situation where using new Error(foo) preferable to using Error(foo) ?
javascript idiomatic error-handling
joeytwiddle Aug 04 '16 at 5:53 on 2016-08-04 05:53
source share