Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

JavaScript/Reserved words/try

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

JavaScript transient typeof Reserved words 0 The try keyword The try keyword is used to be sure that a number of commands to follow will not cause an unhandled exception. If one of the lines causes an exception, the code inside the catch clause will be executed. If the try statement does have a finally clause, this part will execute irrespective of what happened before. Examples The code try { log(-12.05); alert("Executed comment successfully."); } catch(err) { document.getElementById("demo").innerHTML = err.message; } finally { alert("Try finished."); } (Will add to the HTML element called "demo" the error message. An alert window with the text "Try finished." will appear.) See also catch finally throw JavaScript transient typeof Reserved words 0