#ES5 문법
function Car(brand,name,color) {
this.brand = brand;
this.name = name;
this.color = color; //속성정의
}
Car.prototype.refuel = function() {}
Car.prototype.drive = function() {} //메소드 정의
}#ES6 문법
class Car {
constructor(brand,name,color) { //생성자 함수
this.brand = brand;
this.name = name;
this.color = color; //속성정의
}
refuel(){ }
drive( ){ } //메소드 정의
}
let avante(인스턴스) = new Car('hyundai','avante','black')
avante.color; // 'black'