for of and for in javascript

JavaScript
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"
}

// EXAMPLE 2
let pets = new Set(["Cat", "Dog", "Hamster"]);
pets["species"] = "mammals";

for (let pet in pets) {
   console.log(pet); // "species"
}

for (let pet of pets) {
    console.log(pet); // "Cat", "Dog", "Hamster"
}const array = ['hello', 'world', 'of', 'Corona'];

for (const item of array) {
  console.log(item);
}const array1 = ['a', 'b', 'c'];

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

// expected output: "a"
// expected output: "b"
// expected output: "c"
const array1 = ['a', 'b', 'c'];

for (const element of array1) {
  console.log(element);
}let arr = ['el1', 'el2', 'el3'];

arr.addedProp = 'arrProp';

// elKey are the property keys
for (let elKey in arr) {
  console.log(elKey);
}

// elValue are the property values
for (let elValue of arr) {
  console.log(elValue)
}const iterable = [10, 20, 30];

for (const value of iterable) {
  console.log("fef"+value);
}
// 10
// 20
// 30

Source

Also in JavaScript: