let arr = ['a','b','c']


for (let i in arr) console.log(i);

이 때 i는 index가 된다

즉, in은 Array의 index를 가져오도록 한다


for (let i of arr) console.log(i);

이 때 i는 element(value)가 된다

즉, of는 Array의 element를 가져오도록 한다



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/