Nearby lessons
17 of 40๐ JavaScript for Loop
๐ What is JavaScript for Loop?
The for loop repeats a block of code a specific number of times.
Perfect when you know exactly how many iterations you need.
๐ for Loop Basics
| Attribute | Description |
|---|---|
Syntax | for (initialization; condition; increment) |
Initialization | Executes once before loop starts |
Condition | Evaluated before each iteration |
Increment | Executed after each iteration |
๐นPrint 1 to 10 Using for loop
Code Example
PREVIEW READY
๐นPrint 10 to 1 Using for loop
Code Example
PREVIEW READY
๐นPrint Even Number Using for loop
Code Example
PREVIEW READY
๐นPrint Odd Number Using for loop
Code Example
PREVIEW READY
๐ Nested for Loops
| Attribute | Description |
|---|---|
Usage | Creating grids/multi-dimensional arrays |
Outer Loop | Controls rows |
Inner Loop | Controls columns |
Code Example
PREVIEW READY
๐ง Test Your Knowledge
2 QuestionsProgress: 0 / 2
Keep Going!JS - While Loop