0% found this document useful (0 votes)
4 views1 page

Loops Notes

Uploaded by

bobyk9470
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Loops Notes

Uploaded by

bobyk9470
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Loops - Easy Notes (Beginner Friendly)

1. Loop kya hota hai?


Loop ka matlab hai ek kaam ko baar-baar repeat karna.

2. for loop
Jab hume pata ho kitni baar chalana hai.
Example:
for (let i=1; i<=5; i++){ [Link](i) }

3. while loop
Jab condition ke base pe chalana ho.
Example:
let i=1; while(i<=5){ [Link](i); i++; }

4. do...while loop
Ek baar to pakka chalega.
Example:
let i=1; do{ [Link](i); i++; } while(i<=5)

5. for...of loop
Array ki values ke liye best.
Example:
let arr=[10,20,30]; for(let v of arr){ [Link](v) }

6. for...in loop
Index ya object keys ke liye.
Example:
for(let i in arr){ [Link](i) }

7. Important Tips
- Infinite loop se bacho
- for aur for...of sabse important hain

8. Practice Example
Array sum:
let sum=0; for(let n of [1,2,3]){ sum+=n }

You might also like