发布网友 发布时间:2022-04-23 02:17
共1个回答
热心网友 时间:2022-05-14 15:30
构造器 Constructor
我们先来看“构造函数方式”的具体做法:
function start(){
alert("Bang!!!");
}
//constructor
function Car(color, title){
this.color = color;
this.title = title;
this.start = start;
}
var car1 = new Car("red", "BMW");
var car2 = new Car("yellow", "VOIS");