javascript fo in and of code example
Example 1: forin js
let panier = ['fraise', 'banane', 'poire'];
for (const fruit in panier) {
console.log(panier[fruit]);
}
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