get it on google playCreated with Sketch.
JavaScript> For Loops

For Loops

A for loop lets us create the counter variable inside the parentheses, like var counter = 1;.

for (var counter = 1;) {
 
}

After the semicolon, we place a condition like i < 5 and add another semicolon ;.

for (var i = 1; i < 5;) {
 
}

Last, we increment the counter variable with i++.

for (var i = 1; i < 5; i++) {
 console.log(i);
}
TRY IT ON THE APP