Why is `catch` a [reserved] keyword?

C. Scott Ananian ecmascript at cscott.net
Tue Jun 17 12:36:30 PDT 2014

My guess would be that `catch` is reserved so that (in a future
version of JavaScript) this won't be ambiguous:
try { stuff(); }
catch(e1) { }
catch(e2) { }

Currently JS only allows a single catch clause.  But if it ever grows
guarded catch expressions, then you would want to add multiple catch
clauses.  All but the first could potentially be ambiguous with an
invocation of a function named `catch`.

More information about the es-discuss mailing list