By Hemanta Sundaray on 2022-05-01
A typical for loop includes an iterator variable, which is initialized, checked against the stopping condition and assigned a new value on each loop iteration.
A for loop contains three expressions separated by ; inside the parentheses:
The for loop syntax looks like this:
for (let counter = 0; counter < 5; counter++) {
console.log(counter)
}
In this example, the output would be the following:
0
1
2
3
4