
for Loop – Classic counter‑based loop. Executes the block repeatedly while the condition is true. Gives full index control.
๐ Syntax
for (let i = 0; i < array.length; i++) {
// use array[i]
}
๐งช Example
const nums = [10, 20, 30];
for (let i = 0; i < nums.length; i++) {
console.log(i, nums[i]);
}
Comments
Post a Comment