Affecting Initializer in for-of/in loop head declaration is no longer allowed

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

Description

Previously, the for...in and for...of statements could have an initializer in the loop head declaration, like for (var/let/const x = ... in/of ...). This syntax had incorrectly been permitted by ECMAScript 1 to 5 but has been removed from ECMAScript 6. Firefox now ignores such initializers, so for (var i = 0 in array), for example, will be parsed as for (var i in array).

References