📜  9.4.1.3.更新表达式¶ 循环 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:49.088000             🧑  作者: Mango

代码示例1
/*The final component in a for loop definition is the update expression, 
which executes after every iteration of the loop. While this expression
may be anything, it most often updates the value of the loop variable.

In all of the examples we have seen so far, the update expression has 
been i++, incrementing the loop variable by 1. However, it can update 
the loop variable in other ways.*/


//This loop prints even integers from 0...50.
for (let i = 0; i < 51; i = i + 2) {
   console.log(i);
}