When I do this:
const foo = [0, 1, 2]
for (i = 0; i < foo.length; i ++){
console.log(foo[i], typeof foo[i])
}
I get this:
0 number
1 number
2 number
But when I do this:
for (let item in foo){
console.log(item, typeof item)
}
I get this:
0 string
1 string
2 string
What is going on here?? What rules would I have needed to know to predict this?
Edit: I am running Node 12.18.3