JavaScript provides exception handling with try/catch statements. Since JavaScript is implemented using the Java interface, it supports all the DOM and AOM exception classes summarized in
Java Interface Exceptions and defined in
Interface Overview. Most exception classes define a numeric error code attribute named
code and message attribute named
message. The symbolic names for the error codes listed with each exception interface description are available for the global exception objects listed in
JavaScript Global Objects. For example,