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 ...
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.