클래스
// 클래스(es6) : 함수의 집합체
class Info6 {
constructor(name, job){
this.name = name;
this.job = job;
}
study(){
document.write("8. 내 이름은 " +this.name + "이고, 직업은 "+ this.job + "입니다.<br>");
}
};
// 인스턴스 객체 생성
let char7 = new Info6("웹쓰", "웹 퍼블리셔");
let char8 = new Info6("웹 스토리보이", "웹 프로트엔드 개발자");
//메서드 실행
char7.study();
char8.study();
Last updated
Was this helpful?