## 객체지향 : 하나의 모델이 되는 청사진(class)을 만들고 청사진을 바탕으로 한 객체(instance) 를 찍어낸다.
속성
ex)브랜드, 이름, 색, 최고속도메소드
ex)연료채우기, 속도정하기, 운전하기(ES5)
•function 으로 선언function Car(brand, model, color){ this.brand = brand; this.model = model; this.color = color; } ✓Car = class , 전체 = constructor , this = this객체
(ES6)
•class로 선언class Car(){ constructor (brand, model, color) this.brand = brand; this.model = model; this.color = color; } ✓class 를 사용할때는 첫글자를 대문자로 적어준다. ✓ constructor : 인스턴스의 초기 속성값을 생성하는 함수
let avante = new Car('hyundai', 'avante', 'black') // avante.brand // 'hyundai' // avante.color // 'black' ✓instance는 new 를 사용하여 만든다.
Car.prototype.drive = function(){ console.log(this.model + '출발'); } // avante.drive(); // avante 출발 ✓ prototype : class의 메소드를 만들때사용(행동을 정의)