250x250
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 가스요금폭탄
- IOT
- Node
- 가스비절약
- node.js
- Swipes
- Raspberry Pi
- nodejs
- anydo
- evernote
- debounce
- ReactNative
- __attribute__
- 에버노트
- 기름보일러
- npm moment
- 라온익스
- 경동
- 난방비절약
- react-native
- 네모안
- EditText
- rasppi3
- REACT
- 나비엔
- xcode11
- 온도조절기
- 온도센서
- todoist
- 린나이온도조절기
Archives
- Today
- Total
어허
for(let i in myArray) 에서 i는 string이다 본문
728x90
let myArray = ['a', 'b', 'c', 'd'];
for(let i in myArray) {
console.log(typeof i);
}
결과 : string
당연시 int일 줄 알았는데 string이다.
for(i=0; i<length; i++)
forEach
for in
for of
다양한데
for in은 array 말고 object 일때도 사용이 가능했다.
그래서 그런건가?
추가> for in과 for of의 차이
let myArray = ['a', 'b', 'c'];
for(let i in myArray) {
console.log(i);
}
// 결과 : 0,1,2
for(let i of myArray) {
console.log(i);
}
// 결과 : a,b,c
728x90
'개발 > JavaScript' 카테고리의 다른 글
DataTable warning alert 출력 안보이게 하기 (0) | 2018.02.13 |
---|---|
Node.js post로 받은 json을 그대로 사용하면 int를 int로 하지않고 string으로 처리해버림 (0) | 2016.11.21 |
Comments