Can please someone give an example of third for loop
from specification and explain what does it mean?
14.7.4 The for Statement
Syntax
ForStatement[Yield, Await, Return] :
for ( [lookahead ≠ let [] Expression[~In, ?Yield, ?Await] opt ; Expression[+In, ?Yield, ?Await] opt ; Expression[+In, ?Yield, ?Await] opt ) Statement[?Yield, ?Await, ?Return]
for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await] opt ; Expression[+In, ?Yield, ?Await] opt ) Statement[?Yield, ?Await, ?Return]
for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await] opt ; Expression[+In, ?Yield, ?Await] opt ) Statement[?Yield, ?Await, ?Return]
If you look at the definition of
LexicalDeclaration
, you can see it is defined as:So all three cases of
for
loops have two semicolons. Lexical declarations are not expressions and so they have chosen to include the semicolon in its definition, rather than following every use of LexicalDeclaration with ;.