javascript for...of index
for (const [i, v] of ['a', 'b', 'c'].entries()) {
console.log(i, v)
}
javascript for...of index
for (const [i, v] of ['a', 'b', 'c'].entries()) {
console.log(i, v)
}
for of js
let list = [4, 5, 6];
for (let i in list) {
console.log(i); // "0", "1", "2",
}
for (let i of list) {
console.log(i); // "4", "5", "6"
}
for of js
//for ... of statement
const array1 = ['a', 'b', 'c'];
for (const element of array1) {
console.log(element);
}
// expected output: "a"
// expected output: "b"
// expected output: "c"
for of js
let panier = ['fraise', 'banane', 'poire'];
for (const fruit of panier) {
// console.log(fruit);
console.log(panier.indexOf(fruit));
}
javascript for of
const array = ['hello', 'world', 'of', 'Corona'];
for (const item of array) {
console.log(item);
}
for of loop
Create a loop that runs through each item in the fruits array.
var fruits = ['Apple', 'Banana', 'Orange']
for (x of fruits){
console.log(x)
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us