.el은 자바스크립트의 식별자(identifier) 중 하나이며, element 요소를 나타낸다.
생성자 함수를 공부하다가 나왔다
참고로 생성자 만들 때마다 생성자 안에 const this = {} 라고 내부적으로 객체가 생성되는 것을 알고 있자
function SuperElement(type,content){
this.el = document.createElement(type),
this.el.innerText = content,
document.body.append(this.el),
this.el.addEventListener("click",()=>{
console.log(this.el);
})
}
'Development (국비 복습 ) > JavaScript' 카테고리의 다른 글
자바스크립트 call() (0) | 2023.02.22 |
---|---|
자바스크립트 this 키워드 !!!!!!!!!! (0) | 2023.02.22 |
배열 요소 삭제방법 (0) | 2023.02.21 |
Factory Functions (3) | 2023.02.19 |
생성자(constructor)와 prototype , __proto__ (0) | 2023.02.19 |
댓글