1、
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
const car1 = new Car('Eagle', 'Talon TSi', 1993);
console.log(car1.make); // Eagle
2、
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
const car1 = Car('Eagle', 'Talon TSi', 1993);
console.log(car1.make); // Error: Cannot read property 'make' of undefined
3、
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
return this;
}
const car1 = Car('Eagle', 'Talon TSi', 1993);
console.log(car1.make); // Eagle
