로딩
티스토리 데이터 처리 중입니다.

innerHTML과 appendChild 선언 방식

 innerHTML과 appendChild 선언 방식

innerHTML이 중복으로 선언되면 최신으로 선언된 것만 출력 appendChild은 부모 요소에서 자식 요소를 하나의 노드만 추가 할 수 있는 메서드 코드로 확인 index.html 자식 요소가 없는 id값이 root인 div요소 선언 index.js import List from "./list.js"; const $root = document.getElementById("root"); $root.innerHTML = `Hello`; new List({ $root }); id값이 root인 div를 변수 $root로 지정하여 innerHTML을 이용하여 자식 요소로 hello내용인 div요소 넣기 list.js export default function List({ $root }) { $root.in.....