A for loop lets us create the counter variable inside the parentheses, like let counter = 1;
.
for (let counter = 1;) {}
After the semicolon, we place a condition like i < 5
and add another semicolon ;
.
for (let i = 1; i < 5;) {}
Last, we increment the counter variable with i++
.
for (let i = 1; i < 5; i++) {
console.log(i);
}