Prototype

    ES class와 prototype

    ES class ES class란 JavaScript에서 객체 지향 프로그래밍을 구현하기 위해 정의된 문법적 구조를 의미한다. class Car{ constructor(brand){ this.brand = brand } move(){ console.log("moving"); } } c++등의 객체 지향 언어와 유사하게, constructor를 정의하여 object 생성 시 초기화 작업을 수행하도록 할 수 있다. 또한 다음과 같이 상속을 구현 할 수 있다. class Car{ constructor(brand){ this.brand = brand; } move(){ console.log("moving"); } } class ElectricCar extends Car{ constructor(brand, bat..