About Lesson
for Loop
The for loop is commonly used when you know how many times you want to iterate.
Syntax:
JavaScript
for (initialization; condition; increment) {
// Code to be executed
}
Example:
JavaScript
for (let i = 0; i < 5; i++) {
console.log(i); // Prints 0 to 4
}