Loops: for, while, for...of — Free JavaScript Tutorial

Learn Loops: for, while, for...of in JavaScript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Loops: for, while, for...of — Free JavaScript Tutorial

Learn Loops: for, while, for...of in JavaScript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: Learn Loops: for, while, for...of in JavaScript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

Loops: for, while, for...of in JavaScript

`for` loop: `for(let i=0; i<n; i++)` — best when you know how many times to iterate.

`while` loop: `while(condition)` — best when condition-based, number of iterations unknown.

`do...while`: Runs at least once, then checks condition.

`for...of`: Iterates over iterable values (arrays, strings). `for (const item of array)`.

`for...in`: Iterates over object KEYS. `break` exits loop early. `continue` skips to next iteration.

Learn Loops: for, while, for...of step by step with Syllab's free interactive JavaScript tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full JavaScript course →