01
Overview
Loops: for, while. Modern: for-of, enumerate/zip. Functional: map, filter, reduce. Choose by intent.
bash
for(const x of arr){}
const dbl=arr.map(x=>x*2);
const sum=arr.reduce((a,b)=>a+b,0);02
Best Practices
Prefer functional iteration for transformations. Use for-of for side-effects. Never for-in over arrays. Use break to exit early.
Ready to try Loop Patterns & Iteration?
Visit the official site for the latest version and full documentation.
Visit Loop Patterns & Iteration