0

In exceptional circumstances in javascript code, you can break out of the current control flow by throwing, e.g.:

throw new Error('Something unexpected occurred.');

What's the point of instantiating an Error, when you can also just throw a String:

throw 'Something unexpected occurred.';
Armand
  • 22,275
  • 20
  • 85
  • 117

0 Answers0