const person = ['rio',19,'javascript']
for(let i = 0; i < person.length; i++){
console.log(i);
}
// above code give me index 0,1,2;
but when i apply for of loop,
for(let i of person){
console.log(i);
}
// output is rio,19,javascript which is values of my array
so,
my question is why only using i is giving me value of my array and not same in case of normal for loop ?
what is the difference between this two ?
Hello @ilenia the normal for loop would simply have a syntax like this ~
const person = ['rio',19,'javascript']
for(let i = 0; i < person.length; i++){
console.log(person[i]);
// So it may mean **"i"** properties of person
}