Error

JScript5.0+Syntax

var variable = new Error();
var variable = new Error(num);
var variable = new Error(num, description);

Description

The Error object contains information about errors. The Error() constructors can be used to create custom errors. The arguments and properties associated with the Error object are listed in Table 9.8.

Table 9.8. Arguments and Properties Associated with the Error Object
TypeItemDescription
ArgumentsnumberA number assigned to an error—Zero, if no number is provided in constructor.
 descriptionA string that describes the error—empty string, if no string is provided in constructor.
PropertiesdescriptionSets or returns the description string associated with a specific error.
 numberSets or returns the number associated ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.