- 第一种
var Car = function() {
this.wheels = 4;
this.engines = 1;
this.seats = 1;
}; - 第二种
var Car = function(wheels, seats, engines) {
this.wheels = wheels;
this.seats = seats;
this.engines = engines;
}; - 第三种
var car = {
“wheels”:4,
“engines”:1,
“seats”:5
};
js对象构造方法
最新推荐文章于 2020-02-15 15:33:25 发布