Answers for "for in list javascript"

2

for elem in list javascript

var myList = ["first element", "second element", "third element"];

for (let elem in myList) {
	console.log(elem);
}
Posted by: Guest on August-26-2020
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
3

for value in array javascript

const array1 = ['a', 'b', 'c'];

array1.forEach(element => console.log(element));

// expected output: "a"
// expected output: "b"
// expected output: "c"
Posted by: Guest on April-08-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language