본문 바로가기
Development (국비 복습 )/JavaScript

자바스크립트 .el?

by Puddingforever 2023. 2. 21.

.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);
    })
}

 

댓글