Answers for "for of loop"

5

javascript for...of index

for (const [i, v] of ['a', 'b', 'c'].entries()) {
  console.log(i, v)
}
Posted by: Guest on November-29-2019
38

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"
}
Posted by: Guest on April-01-2020
2

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"
Posted by: Guest on September-15-2021
6

for of js

let panier = ['fraise', 'banane', 'poire'];

for (const fruit of panier) {
  // console.log(fruit);
  console.log(panier.indexOf(fruit));
}
Posted by: Guest on March-13-2020
8

javascript for of

const array = ['hello', 'world', 'of', 'Corona'];

for (const item of array) {
  console.log(item);
}
Posted by: Guest on March-13-2020
1

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)
}
Posted by: Guest on June-10-2021

Browse Popular Code Answers by Language