//자바스크립트 객체 표현 패턴 총정리
//객체 리터럴 방법
// const Cars = {
// init(name, year) {
// this.carName = name;
// this.carYear = year;
// },
// getCarName() {
// this.carName;
// },
// getCarYear() {
// this.carYear;
// },
// getCarInfo() {
// return name: ${this.carName}, year: ${this.carYear};
// },
// };
// Cars.init("moning", 2003);
// Cars.getCarInfo();
//클래스 Class
// class Cars {
// constructor(name, year) {
// this.carName = name;
// this.carYear = year;
// }
// getCarName() {
// this.carName;
// }
// getCarYear() {
// this.carYear;
// }
// getCarInfo() {
// return name: ${this.carName}, year: ${this.carYear};
// }
// }
// const car = new Cars("morning, 2003");
// console.log(car.getCarInfo());
//
//프로토 타입 적용 (지금은 안쓰는 방법)
// function Cars(name, year) {
// this.carName = name;
// this.carYear = year;
// } // return this;
// Cars.prototype.getCarName = function () {
// this.carName;
// };
// Cars.prototype.getCarYear = function () {
// this.carYear;
// };
// Cars.prototype.getCarInfo = function () {
// return name: ${this.carName}, year: ${this.carYear};
// };
// const car = new Cars("morning, 2003");
// console.log(car.getCarInfo());