Class는 3가지의 메서드를 가진다.
class Person {
// 생성자
constructor(name) {
this.name = name;
this.age = 16;
this.job = "developer";
}
// 프로토타입 메소드
introduce() {
return `Hello, my name is ${this.name} and I'm ${this.age}years old.`;
}
// 정적 메소드
static country() {
return `I'm living in Toronto`;
}
}
const person = new Person("우기");
Person.country();
const person = new Person('우기');
person.introduce();