DOM

- createElement() : Node 생성

- Node : 객체, 트리 구조로 이루어짐 

 

 Text

- var textNode = document.createTextNode("안녕");

- TextContent : <script>, <style> 요소를 포함해서 모든 요소를 가져옴

- InnerText : 사람이 읽을 수 있는 요소만 처리, css에 종속적이라 reflow비용 발생

- InnerHtml : html 파싱 비용 발생 X, html을 그대로 가져옴
- https://developer.mozilla.org/ko/docs/Web/API/Node/textContent

 

객체에 key 존재 여부 확인

- "key" in obj : 해당 객체의 prototype chain을 거슬러 올라가서(상속된 곳 까지) key가 존재하면 true

- Object.prototype.hasOwnProperty(obj, "key") : 해당 객체가 key를 직접 가질 때에만 true

 

 

 

 

 

 

 

+ Recent posts