< JavaScript < Reserved words
![](../../../I/m/Crystal_Clear_action_apply.png)
The code
The catch keyword
The catch keyword is used as part of the try statement.
Examples
![](../../../I/m/Crystal_Clear_action_apply.png)
try {
log(-12.05);
alert("Executed comment successfully.");
} catch(err) {
document.getElementById("demo").innerHTML = err.message;
}
</script>
(Will add to the HTML element called "demo" the error message.)
See also
This article is issued from
Wikibooks.
The text is licensed under Creative
Commons - Attribution - Sharealike.
Additional terms may apply for the media files.