Need help with constructor tutorial on Javascript

Need help with constructor tutorial on Javascript
0.0 0

#1

So they’re asking me to comply with these intructions:

"Now, once the myCar instance is created it can be used like any other object and can have its properties accessed and modified the same way you would usually. For example:

myCar.turboType = “twin”;

Our myCar variable now has a property turboType with a value of “twin”.

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."

The code looks like this:

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

// Only change code below this line.

var myCar;

So I tried the following code for var myCar:

var myCar = new Car();
myCar.nickname = “Turbo”;

It didn’t work. Can anyone help assist me?


#2

It should work. Maybe if you “Reset” the challenge, it will work.


#3

Oh cool it did work thanks!