Notice
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 | 29 | 30 | 31 |
Tags
- input type=file
- 컨디셔널 렌더링
- fetch
- Git
- styled components
- react
- nextjs
- dart 변수
- npm styled-reset
- There isn’t anything to compare
- API token
- react env
- nextjs .env
- createGlobalStyle
- git lab
- next.js css
- github
- bootstrap
- rewrites
- typescript react
- ngrok설치
- API 토큰
- github io
- ngrok실행
- SCSS
- icon
- nextjs 설치
- getModifierState
- CSS
- react typescript
Archives
- Today
- Total
꾸준히 성장하는 개발자
HTMLCollection - > Array로 바꾸기 본문
getElementByClassName으로 태그들을 부르게 되면 HTMLCollection으로 나타나는데
이를 array 형식으로 바꾸길 원한다면
Array.from(......) 메소드를 넣어주면 array 형식으로 바뀌게 된다.
const colors = document.getElementsByClassName("jsColor");
console.log(colors);
console.log(Array.from(colors));
만약 처음부터
document.querySelectorAll(".jsColor");
주게 된다면 이 방법도 array로 주게 되어 이대로 사용가능하다
const jsColor = document.querySelectorAll(".jsColor");
console.log(jsColor);
console.log(jsColor[0]);
'JavaScript' 카테고리의 다른 글
[JavaScript] 시계 만들기 (0) | 2022.02.28 |
---|---|
물음표 연산자 , 삼항연산자 , 조건부 연산자 (0) | 2022.02.27 |
var , let , const (0) | 2021.12.28 |
Youtube iframe API (0) | 2021.12.28 |
node.js 준비하기 (0) | 2021.12.24 |