JavaScript/Reserved words/catch

Previous: case Reserved words Next: char

The catch keyword

The catch keyword is used as part of the try statement.

Examples

The code
  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

Previous: case Reserved words Next: char
Category:Book:JavaScript#Reserved%20words/catch%20
Category:Book:JavaScript