Export (0) Print
Expand All

2.4.10.2 new Error(number, message)

When the Error constructor is called with two or more arguments, the following steps are taken:

  1. The [[Prototype]] property of the newly constructed object is set to the original Error prototype object, the one that is the initial value of Error.prototype ([ECMA-262] Section 15.11.3.1).

  2. The [[Class]] property of the newly constructed Error object is set to "Error".

  3. Let num be ToNumber(number).

  4. Let msg be ToString(message).

  5. The description property of the newly constructed object is set to msg.

  6. The message property of the newly constructed object is set to msg.

  7. The name property of the newly constructed object is set to "Error".

  8. The number property of the newly constructed object is set to num.

  9. Return the newly constructed object.

Show:
© 2014 Microsoft