Error objects

Error objects are created either by the environment (the browser) or by your code:

    > var e = new Error('jaavcsritp is _not_ how you spell it'), 
    > typeof e; 
    "object" 

Other than the Error constructor, six additional ones exist and they all inherit Error:

  • EvalError
  • RangeError
  • ReferenceError
  • SyntaxError
  • TypeError
  • URIError

The Error.prototype members

Following are the Error.prototype members:

Property

Description

name

The name of the error constructor used to create the object:

    > var e = new EvalError('Oops'),   
    > e.name;   
    "EvalError"   

message

Additional error information:

    > var e = new Error('Oops...   again'),   
    > e.message;   
    "Oops... again"   

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.42.196