throw Error(‘msg’) vs throw new Error(‘msg’)

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.

Leave a Comment