자바스크립트1 클래스 클래스는 IE에서 지원하지 않는다. 간단하게 살펴보고 넘어가자. 객체 생성자와 프로토타입에 함수를 등록할 때 편하다. Animal 클래스를 만들고 객체를 만들려면? class Animal { constructor(type, name, sound) { this.type = type; this.name = name; this.sound = sound; } say() { console.log(this.sound); } }; const dog = new Animal("개", "멍멍이", "멍멍"); dog.say(); say가 prototype에 자동으로 등록됨. Dog 클래스를 만들려면? class Dog extends Animal { constructor(name, sound) { super("개", nam.. 2020. 6. 27. 이전 1 다음