for loop with of javascript code example
Example 1: js for loop
var i;
for (i = 0; i < 5; i++) {
console.log("The Number Is: " + i);
};
console.log("The Number Is: " + 0);
console.log("The Number Is: " + 1);
console.log("The Number Is: " + 2);
console.log("The Number Is: " + 3);
console.log("The Number Is: " + 4);
Example 2: javascript for of
const array = ['hello', 'world', 'of', 'Corona'];
for (const item of array) {
console.log(item);
}
Example 3: for of loop javascript
const array1 = ['a', 'b', 'c'];
for (const element of array1) {
console.log(element);
}
Example 4: for of loop syntax javascript
for (let step = 0; step < 5; step++) {
console.log('Walking east one step');
}
Example 5: javascript for of loop
for (variable of iterable) {
statement
}
Example 6: javascript for loop[
for(i=0;i<=5;i++){
console.log(i);}