Error() (Constructor)

An Error object constructor.


ECMAScript edition - 3
JavaScript - 1.5
JScript - 5.0
Internet Explorer - 5.0
Netscape - 6.0
JavaScript syntax:-new Error()
-new Error(aNumber)
-new Error(aNumber, aText)
Argument list:aNumberAn error number
aTextA text describing the error

The Error() constructor can be called with the new operator or as a function.

The initial value of Error.prototype.constructor is the built-in Error() constructor.

The two arguments supplied to the Error() constructor describe the error number and a textual description. They are all optional.

A prototype property is automatically created in case the Error object is used as a constructor at some future time.

See also:Constructor function, constructor property, Error.prototype


ECMA 262 edition 3 - section - 15.11.2