You are viewing a single comment's thread from:

RE: JavaScript开发笔记

in #starnote2 days ago

new 运算符创建一个用户定义的对象类型的实例或具有构造函数的内置对象的实例。
new constructor[([arguments])]

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)