Affecting ES6-compatible let disallows variable redeclaration

Published: | Categories: JavaScript | Creative Commons BY-SA 3.0

Description

The let statement implementation has been updated to support the “temporal dead zone” of the ECMAScript 6 spec, though the implementation is not yet fully ES6-compatible. Starting with Firefox 35, redeclaring an existing variable in the same block scope throws a TypeError, while referring a variable before the variable is declared raises a ReferenceError. This change will mainly affect Open Web Apps for Firefox and Firefox OS, as well as Firefox extensions. See also the newsgroup announcement for details.

Update: Starting with Firefox 46, redeclaration of variables will throw a SyntaxError instead of TypeError as per the spec.

References