In this section, we'll briefly describe what each type of built-in object is, along with its syntax, before we show some examples of how each of the built-in objects work. Do take note that the alert messages, which we will be using sparingly in the examples, are based on the Firefox browser. If you try the code on Internet Explorer, you might see different error messages.
Error is a generic exception, and it accepts an optional message that provides details of the exception. We can use the
Error object by using the following syntax:
new Error(message); // message can be a string or an integer
Here's an example that shows the
Error object in action. The source code for this example can ...