t2a18-loop-1page-illia.html

use an LLM to make a one page html file shows all the types of javascript loops, then print page and circle the code you dont undersrtant. // 1️⃣ for loop — use when you know how many times to loop for (let i = 0; i < 5; i++) console.log(i); // 2️⃣ while loop — run while a condition is true let a = 0; while (a < 5) console.log(a++); // 3️⃣ do...while — runs at least once let b = 0; do console.log(b++); while (b < 5); // 4️⃣ for...in — loop over object KEYS const person = { name: "Alice", age: 25 }; for (let key in person) console.log(key, person[key]); // 5️⃣ for...of — loop over iterable VALUES (arrays, strings, etc.) const fruits = ["apple", "banana", "cherry"]; for (let fruit of fruits) console.log(fruit); // 6️⃣ forEach — loop array with a callback (no break/continue) [1, 2, 3, 4].forEach(n => console.log(n)); // 7️⃣ map — transform array, returns a new one const doubled = [1, 2, 3].map(n => n * 2); // [2, 4, 6] // 8️⃣ filter — keep only elements that match a condition const evens = [1, 2, 3, 4, 5].filter(n => n % 2 === 0); // [2, 4] // 9️⃣ reduce — combine array into one value const sum = [1, 2, 3, 4].reduce((total, n) => total + n, 0); // 10 // 🔟 Nested loops — loop inside another loop for (let i = 0; i < 2; i++) for (let j = 0; j < 2; j++) console.log(i, j);