Loops in JavaScript (for, while, do while, forEach)
for
The for loop is the most basic loop in JavaScript. It looks like this:
for (initialization; condition; increment) {
// Statements go here
}
The initialization statement is executed once, before the loop starts. It is typically used to initialize a counter variable.
The condition is evaluated on each iteration of the