Hi,
There is something wrong with this code. How could I improve this?
var Car = function() {
//Change this constructor
this.wheels = 4;
this.seats = 5;
this.engines = 1;
};
//Try it out here
var myCar = function (wheels, seats, engines) {
this.wheels = wheels;
this.seats = seats;
this.engines = engines;
};
var myCar = new Car (3, 8, 2);
Edit: it gives these error messages:
Calling new Car(3,1,2) should produce an object with a wheels property of 3, a seats property of 1, and an engines property of 2.
Calling new Car(4,4,2) should produce an object with a wheels property of 4, a seats property of 4, and an engines property of 2.
Calling new Car(2,6,3) should produce an object with a wheels property of 2, a seats property of 6, and an engines property of 3.