I'm doing a bit of a deep dive into the for loop and encountered ExpressionNoIn
in the spec at http://www.ecma-international.org/ecma-262/5.1/#sec-12.6.3
What does it mean?
It is explained in section 11.14 "Comma Operator ( , )":
The *NoIn
has the same structure, except that in excludes the use of the in
keyword, section 11.8 "Relational Operators":
The spec says:
The "NoIn" variants are needed to avoid confusing the
in
operator in a relational expression with thein
operator in afor
statement.
As in
may be used in two ways:
for (var x in foo) { ... }
Or:
if ('x' in foo) { ... }
The "NoIn" variants are there to make it impossible to use the second version of in
above in the first expression of the for
loop. So, the following code is invalid:
for (y = 'x' in foo; y; y = false) { ... }