error throwing js code example
Example 1: javascript how to raise the error
if (..condition..) {
throw 'Error message';
}
Example 2: javascript throw new error
throw new Error("Error message here"); // Uncaught Error: Error message here
if (..condition..) {
throw 'Error message';
}
throw new Error("Error message here"); // Uncaught Error: Error message here