'var' legal in for..in?

# Mark Ethan Trostler (10 years ago)
# Allen Wirfs-Brock (10 years ago)

On Mar 23, 2015, at 2:45 PM, Mark Ethan Trostler <mark at zzo.com <mailto:mark at zzo.com>> wrote:

Howdy, Is this legal ES6 syntax:

for (var x in [ 1,2,3 ] ) { ... } //?

Can the 'var' be in there? There was alleged talk at some point about making that illegal? Hard to tell from looking at the spec thanks!!

people.mozilla.org/~jorendorff/es6-draft.html#sec-iteration-statements, people.mozilla.org/~jorendorff/es6-draft.html#sec-iteration-statements

7th IterationStatement rule

# Brendan Eich (10 years ago)

You may be thinking of the change to make the var's intiialiser, e.g.,

for (var x = i in o) ...

illegal in ES6.

# Mark Ethan Trostler (10 years ago)

Yes that was it thanks! Mark