Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
John Shofstall
14,308 Pointsstuck on the prototypes
After the 'Car' constructor function, modify the Car's prototype to be the 'carPrototype'.
var carPrototype = {
model: model || "generic",
currentGear: 0,
increaseGear: function() {
this.currentGear ++;
},
decreaseGear: function() {
this.currentGear--;
}
}
function Car(model) {
this.model = model;
}
Car.prototype = carPrototype;
I've tried all kinds of rearrangements and capitalizations, but to no avail. What am I doing wrong?
3 Answers
Kevin Korte
28,149 PointsI passed it, but I don't see the difference between what you typed and what I did. What am I missing?
Don Chedele
7,676 PointsHey Kevin Korte, you originally had your code like this.
<p>Car.prototype = carPrototype();</p>
but you changed it to this
<p>Car.prototype = carPrototype;</p>
firstworldproblems
Kevin Korte
28,149 PointsI'm no JS expert by any means, and I'm not even sure where this test is, but I believe you have to use at least empty parentheses when calling a function even where there aren't any arguments to pass it.
So that would make it
Car.prototype = carPrototype();
John Shofstall
14,308 Pointsit's not a function, it's referring to the object. I tried that and it didn't work, but thank you for trying to help.
Kevin Korte
28,149 PointsYou're right, reading that again, it's not a function. Duh. Is this a code challenge here? If so do you have a link? I'm curious to help figure it out.

John Shofstall
14,308 PointsJohn Shofstall
14,308 Pointsthanks. In the prototype, I had model set to equal another variable OR 'generic'. i guess that threw the rest off
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsI see it now! Must have been it.
Miras Duisenov
2,264 PointsMiras Duisenov
2,264 Pointsthanks