Answers for "for in loop es6"

2

es6 forEach

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

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

// expected output: "a"
// expected output: "b"
// expected output: "c"
Posted by: Guest on August-25-2020
1

for of loop in es6

let colors = ['Red', 'Blue', 'Green'];
for (let color of colors){
	console.log(color);
}
Posted by: Guest on April-25-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language