Closed Bug 1289459 Opened 9 years ago Closed 9 years ago

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

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 1101653

People

(Reporter: swood, Unassigned)

Details

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
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.