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.';