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를 가져오도록 한다
'Language' 카테고리의 다른 글
[GoF Design Pattern] Abstract Factory (2) | 2018.06.21 |
---|---|
Clean Code 독서 & 메모 (0) | 2018.04.22 |
[C] open() vs fopen() (low-level vs high-level I/O API) (0) | 2018.04.05 |
[Java] anonymous subclass (Thread) (0) | 2018.03.15 |
[Visual Studio 2017] scc display information error (0) | 2018.03.06 |
WRITTEN BY
- hojongs
블로그 옮겼습니다 https://hojongs.github.io/