• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Core Syntax > try…catch

try…catch

JScript5.0+, JavaScript1.4 NES3+, IE5+, Nav5+ Syntax

try{
    statement1
}catch(exception){
    statement2
}

Description

The try…catch statement of the JavaScript language contained the try and catch reserve keywords in the JavaScript 1.3 and JScript 3.0 languages and in the Netscape Enterprise server 3 environments. Internet Explorer 5 and Navigator 5 were the first browsers to implement this feature. It can be used to handle all or some of the errors that can occur in a script. If an error is not handled by a try…catch statement, it is passed on so other statements can handle the error. If there are no other statements to handle the error, it is passed to the browser to handle. This usually means a pop-up dialog box to the user or writing the information to the "JavaScript Typein Console" for Navigator 4.06 and higher browsers.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint