for of loop javascript

JavaScript
var listItem = [
        {name: 'myName1', gender: 'male'},
        {name: 'myName2', gender: 'female'},
        {name: 'myName3', gender: 'male'},
        {name: 'myName4', gender: 'female'},
      ]

    for (const iterator of listItem) {
        console.log(iterator.name+ ' and '+ iterator.gender);
    }const array = ['hello', 'world', 'of', 'Corona'];

for (const item of array) {
  console.log(item);
}
for (statement 1; statement 2; statement 3) {

      // code block to be executed

 }

 //this loops through an array, 'cars', and logs each element to the console.
for (var i = 0; i < cars.length; i++) {
  //repeating code here:
  console.log(cars[i]);
}const array = [1, 2, 3];array.forEach(function(elem, index, array) {    array[index] = elem * 2;});console.log(array); // [2,4,6]const array1 = ['a', 'b', 'c'];

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

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

Source

Also in JavaScript: