Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Nazaam Kutisha
7,667 PointsHelp with Challenge
Challenge task 1 of 3
Modify the 'Car' constructor function so that it takes an argument for its model and set its 'model' to the model passed in from the argument.
<script>
var carPrototype = {
model: "generic",
currentGear: 0,
increaseGear: function() {
this.currentGear ++;
},
decreaseGear: function() {
this.currentGear--;
}
}
function Car(model) {
this.model= generic;
}
car.prototype= carPrototype;
</script>
4 Answers

Laura Cressman
12,548 PointsLooks good, except for one tiny thing. You are setting this.model to "generic" in the body of your function definition. Instead, use the model parameter you passed in, so the body says this.model = model;
instead of this.model = generic;
. Let me know if that helps!
Smile:)
Laura

Nazaam Kutisha
7,667 PointsHi Laura,
Brilliant! its always the little things. This code worked for the challenge.
``` function Car(model) {
this.model = model;
}
Many Thanks

Laura Cressman
12,548 PointsNo problem, fresh eyes can certainly be useful! :)

J Scott Erickson
11,883 PointsYou need to set Car.prototype = carPrototype;
and also as the previous poster said: this.model = model;
in your constructor.

Nazaam Kutisha
7,667 PointsThat helped a lot js can kind of leave you hanging. Great responses ...