var err1 = Error('message');
var err2 = new Error('message');
What's the difference? Looking at them in the chrome console, they look identical. Same properties on the object and the same __proto__
chain. Almost seems like Error
acts like a factory.
Which one is correct and why?
new
. – Bridgersnew Error()
better thanError()
? – Conjecture