Regarding JavaScript for() loop voodoo

前端 未结 9 1427
梦如初夏
梦如初夏 2021-02-19 08:53

I was for quite some time under the impression that a for loop could exist solely in the following format:

for (INITIALIZER; STOP CONDITION         


        
9条回答
  •  遥遥无期
    2021-02-19 09:50

    Syntax of for loop is:

    for (pre-block; condition; post-loop-block)
        loop-block;
    

    First, pre-block is executed, various variables are defined.

    In each loop:

    1. check condition
    2. execute loop-block
    3. execute post-loop-block
    4. repeat from 1.

提交回复
热议问题