HTMLCollection과 Nodelist - 유사배열
HTMLCollection? 문서내에 순서대로 정렬된 노드의 컬렉션이다. 가장 쉽게 HTMLCollection을 얻을 수 있는 방법은 엘레먼트의 children 프로퍼티에 접근하는 것이다. console.log(document.body.children); //HTMLCollection(4) [button.modal-toggle, div.modal, div.modal-overlay, script] children과 childNodes의 차이점은 뭘까..? childNodes 현재 노드의 자식 노드가 포함된 Nodelist를 반환한다. 주석과 줄바꿈 같은 비요소 노드까지 출력한다. console.log(document.body.childNodes); //NodeList(8) [text, button.moda..
프론트엔드/JS
2021. 5. 20. 15:45
공지사항