const array = [’apple’, ‘banana’, ‘kiwi’];
for(let i=0; i<array.length; i++) {
console.log(array[i])
}
// apple banana kiwi
for (const fruits in array) {
console.log(fruits)
}
// apple banana kiwi
const user = {
name:’jang’,
age:’33’,
email:’123ajkdf@test.com’
}
for(const key in user) {
console.log(key) // name age email
console.log(user[key]) // jang 33 123ajkdf@test.com
}