Answers for "9.4.1.3. Update Expression¶ // Loops"

0

9.4.1.3. Update Expression¶ // Loops

/*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);
}
Posted by: Guest on June-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language