JavaScript const in (for ...of) throws Syntax Error

RESOLVED DUPLICATE of bug 1101653

Status

()

defect
--
major
RESOLVED DUPLICATE of bug 1101653
3 years ago
3 years ago

People

(Reporter: swood, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

3 years ago
Using the for...of loop construct with the const keyword throws a Syntax Error. The MDN documentation suggests this construct on the second example on this page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of

The error thrown is "SyntaxError: missing = in const declaration".  The for...of loop works with the var and let keyword when used in the same way.

Code:
for (const n of [1, 2, 3]) { console.log(n); }
Known bug.  A wide-ranging rewrite of our parser (bug 1263355), mostly complete now except for dealing with some perf concerns and the full gamut of tbpl tests, should fix this in the next few months on trunk.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1101653
You need to log in before you can comment on or make changes to this bug.