Error.number

JScript5.0+Syntax

							errorobj.number
errorobj.number = number;
						

Description

The number property associated with the Error object contains the error number of the error. This method is read/write, so you can assign an error number using this property.

Example

Listing 9.48 creates an Error object and then displays the error number.

Listing 9.48 Error Number Associated with Custom Error
<html>

<script language="JScript">
<!-- Hide

//Create an Error object
var myError = new Error(45,"A really big error!");

//Display error number associated with the custom error
document.write("The custom error number is ");
document.write(myError.number);

//Hide End -->
</script>
</html>
						

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.