var Car = function() {
this.wheels = 4;
this.engines = 1;
this.seats = 5;
};
var myCar = new Car();
myCar.wheels = 4;
myCar.nickname = "H";
//{"wheels":4,"engines":1,"seats":5,"nickname":"H"}
var Car = function() {
this.wheels = 4;
this.engines = 1;
this.seats = 5;
};
var myCar = new Car();
Car.wheels = 4;
Car.nickname = "H";
//{"wheels":4,"engines":1,"seats":5}
var Car = function(wheels,seats,engines) {
//Change this constructor
this.wheels = wheels;
this.seats = seats;
this.engines = engines;
};
var myCar = new Car(4,2,3); //可以
myCar(4,2,3); //不可以,如果用myCar如何快速添加参数
慕仙森
相关分类