function LabTop(brand, model, year) {
this.brand = brand;
this.model = model;
this.year = year;
}
LabTop.prototype.compatible = function () {
console.log(`${this.brand} ${this.year} ${this.model}는(은) 이 프로그램과 호환됩니다.`);
}
LabTop.prototype.incompatible = function () {
console.log(`${this.brand} ${this.year} ${this.model}는(은) 이 프로그램과 호환되지 않습니다.`)
}
let macBookPro = new LabTop('apple', 'macbook pro', 2018)
let surface = new LabTop("MS", "surface pro", 2019);
let macBookPro2 = new LabTop('apple', 'macbook pro', 2011)
function test (computer) {
if(computer.year < 2018) {
computer.incompatible();
} else {
computer.compatible();
}
}
실행화면
