I've seen examples of throw
that use Error
and new Error
:
throw new Error('new Error')
and
throw Error('Error')
i.e.:
(function(){ throw new Error('new Error') })()
(function(){ throw Error('Error') })()
(cut/paste in console to see that they both work)
Is there any reason to include the new
?
I ask because I think throwing Errors is preferred to throwing strings .. better stack trace I think, but if the new isn't needed, I'll drop it.