throw new error throw object javascript 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