Thanks for the question @mommollman. It made me review some things.

Check this out:

const arr = [10, 15, 20, 25]for(let i in arr){
console.log(i)
}
// PRINTS OUT: 0, 1, 2, 3
for(let i of arr){
console.log(i)
}
// PRINTS OUT: 10, 15, 20, 25

for..in returns a list of keys on the object being iterated, whereas for..of returns a list of values of the numeric properties of the object being iterated.

--

--

Always learning.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store