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如何快速添加參數(shù)
請(qǐng)問(wèn)下例,如何理解實(shí)例,構(gòu)造函數(shù),對(duì)象有點(diǎn)迷糊了,還有構(gòu)造函數(shù)的參數(shù)問(wèn)題
12345678_0001
2018-12-13 18:14:49