for | js for
Theforstatementcreatesaloopthatconsistsofthreeoptionalexpressions,enclosedinparenthesesandseparatedbysemicolons,followedbyastatement(usuallyablockstatement[1])tobeexecutedintheloop.for([initialization];[condition];[final-expression])statementinitializationAnexpression(includingassignmentexpressions)orvariabledeclarationevaluatedoncebeforetheloopbegins.Typicallyusedtoinitializeacountervariable.Thisexpressionmayoptionallydeclarenewvariableswithvarorletkeywords.Variablesdeclaredwithvararenotloc...
The for statement creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement (usually a block statement[1]) to be executed in the loop.
for ([initialization]; [condition]; [final-expression]) statement initializationAn expression (including assignment expressions) or variable declaration evaluated once before the loop begins. Typically used to initialize a counter variable. This expression may optionally declare new variables with var or let keywords. Variables declared with var are not local to the loop, i.e. they are in the same scope the for loop is in. Variables declared with let are local to the statement.
The result of this expression is discarded.
conditionAn expression to be evaluated before each loop iteration. If this expression evaluates to true[2], statement is executed. This condit...