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
  • 23,463
  • 20
  • 90
  • 119

0 Answers0