var err1 = Error(\'message\'); var err2 = new Error(\'message\');
What\'s the difference? Looking at them in the chrome console, they look identica
Both are fine; this is explicitly stated in the specification:
... Thus the function call Error(…) is equivalent to the object creation expression new Error(…) with the same arguments.
Error(…)
new Error(…)