for vs for in javascript code example
Example 1: for of vs for in
for (variable in enumerable) {
// do stuff
}
Example 2: for of vs for in
const array = ['a', 'b', 'c', 'd'];
for (const index in array) {
console.log(array[index])
}
// Result: a, b, c, d