class Person { }
//클래스 선언문
const Person = class {};
//익명 클래스 표현식
const Person = class MyClass {};
//기명 클래스 표현식
클래스를 표현식으로 정의할 수 있다는건 클래스가 값으로 사용할 수 있는 일급 객체라는 것을 의미
클래스의 몸체에 정의할 수 있는 메서드는 constructor(생성자), 프로토타입 메서드, 정적 메서드
//클래스 선언문
class Person {
constructor(name) {
//생성자, 인스턴스 생성 및 초기화
this.name = name;
// name 프로퍼티는 public
}
sayHi() { //프로토타입 메서드
console.log(`Hi! My name is ${this.name}`);
}
static sayHello(){ //정적 메서드
console.log('hello!');
}
}
//인스턴스 생성
const me = new Person('Lee');
//인스턴스의 프로퍼티 참조
console.log(me.name) // Lee
//프로토타입 메서드 호출
me.sayHi(); // Hi! My name is Lee
//정적 메서드 호출
Person.sayHello(); // hello!


class Person {}
const me = new Person();
console.log(me) // Person {}
