for let in js code example

Example 1: javascript for of

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

for (const item of array) {
  console.log(item);
}

Example 2: for of loop javascript

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

for (const element of array1) {
  console.log(element);
}

// expected output: "a"
// expected output: "b"
// expected output: "c"

Example 3: for of loop in es6

let colors = ['Red', 'Blue', 'Green'];
for (let color of colors){
	console.log(color);
}

Example 4: how to use for of in javascript

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

for (const element of array1) {
  console.log(element);
}