The ES5 language spec clearly states that Error(foo)
does the same thing as new Error(foo)
.
But I notice that in the wild, the longer new Error(foo)
form is much more common.
Is there some reason for this?
Is there any situation where using new Error(foo)
is preferable to using Error(foo)
?