Illie
JS. 클래스 본문
{
class study {
constructor(num, name, job){
this.num = num;
this.name = name;
this.job = job;
}
result(){
document.write(this.num + ".내 이름은 " + this.name + "이며, 직업은 " + this.job + "입니다.");
}
}
const info1 = new study(1, "웹쓰", "웹퍼블리셔");
const info2 = new study(2, "웹스토리보이", "프론트엔드개발자");
info1.result();
info2.result();
}
'JAVASCRIPT > 자바스크립트' 카테고리의 다른 글
JS. 부모, 자식, 형제 찾기, 선택하기 (0) | 2022.04.15 |
---|---|
JS. 클래스 상속 (0) | 2022.04.15 |
JS. 객체리터럴 함수 (0) | 2022.04.15 |
JS. 프로토타입 함수 (0) | 2022.04.15 |
JS. forEach문으로 JSON 값 가져오기 (0) | 2022.04.15 |
Comments