Make Instances of Objects with a Constructor Function

Make Instances of Objects with a Constructor Function
0

#1

Tell us what’s happening:

Your code so far

var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 5;
};


var myCar = new Car();
myCar.sportsType = "red";

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8.

Link to the challenge:


#3

Here’s what you have to do:

In the editor, use the Car constructor to create a new instance and assign it to myCar.
Then give myCar a nickname property with a string value.

Instead of myCar.sportsType, you have to type myCar.nickname as you have to provide a nickname property as described above.

myCar.nickname = "Lightning McQueen";