for on js code example
Example 1: javascript for loop
for (var i; i < 10; i++) {
}
Example 2: javascript for
let str = "";
for (let i = 0; i < 9; i++) {
str = str + i;
}
console.log(str);
Example 3: javascript for of
const array = ['hello', 'world', 'of', 'Corona'];
for (const item of array) {
console.log(item);
}
Example 4: forin js
let panier = ['fraise', 'banane', 'poire'];
for (const fruit in panier) {
console.log(panier[fruit]);
}
Example 5: for javascipt
for (let i = 0; i < 9; i++) {
str = str + i;
}
Example 6: es6 for-of loop
for (let itme of list) {
...
}