for (initialzation; condition; update) {
// code block
}Outputs numbers 0 through 4.
while (condition) {
// code block
}do {
// code block
} while (condition)Runs the block at least once before checking the condition.
Best for iterating through arrays or strings.
Used for iterating over object properties.
for (let i = 0; i < 5; i++) {
if (i === 3) break; // stops the loop
if (i === 1) continue; // skips iteration
console.log(i);
}Prints 0, 2.
for...of for arrays and stringswhile when the end condition is unknownbreak and continue to maintain readabilityAsk the AI if you need help understanding or want to dive deeper in any topic