JavaScript throw
JavaScript throw
The throw statement is used to throw/generate an error. It allows us to create our own custom errors. In other words, we can say that the throw statement throws an exception. It can be String, Number, Boolean, Object, etc.
Syntax:-
Its syntax is:- throw expression;
Further Explanation:-
Parameter | Description |
expression | Required. The exception to throw. |