throw new exception with error code js code example
Example 1: javascript throw new error
throw new Error("Error message here"); // Uncaught Error: Error message here
Example 2: js throw new error
throw new Error("message");
throw new Error("Error message here"); // Uncaught Error: Error message here
throw new Error("message");