Content deleted Content added
Hägar Dünor (talk | contribs) m →Date: Months corrected: 2→3 |
→Exception handling: Changed formatting. Tags: Mobile edit Mobile web edit |
||
Line 1,405:
==Exception handling==
JavaScript includes a <code>try … catch … finally</code> [[exception handling]] statement to handle run-time errors.
The <code>try … catch … finally</code> statement catches [[exception handling|exceptions]] resulting from an error or a
<syntaxhighlight lang=JavaScript>
Line 1,419:
</syntaxhighlight>
Initially, the statements within the try block execute. If an exception is thrown, the script's control flow immediately transfers to the statements in the catch block, with the exception available as the error argument. Otherwise the catch block is skipped. The catch block can
In any case the statements in the finally block are always executed. This can be used to free resources, although memory is automatically garbage collected.
Line 1,435:
</syntaxhighlight>
In a browser, the
<!-- This needs verification -->
|