Language concepts

Exception propagation

Try the free JavaScript compiler

A thrown value propagates through callers until handled or until the host reports an uncaught exception. A new throw in catch propagates outward.

Formal Syntax & Structure

javascript syntaxjavascript
try { work(); } catch (error) { ... }

Working Example

Example Snippetjavascript
function f(){throw new Error("bad");} try {f();} catch(e){console.log(e.message);}
JavaScript Reference