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

JavaScript JavaScript Foundations Objects Prototypes

Help 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

Looks 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

Hi Laura,

Brilliant! its always the little things. This code worked for the challenge.

``` function Car(model) {

this.model = model;

}

Many Thanks

No problem, fresh eyes can certainly be useful! :)

You need to set Car.prototype = carPrototype;

and also as the previous poster said: this.model = model; in your constructor.

That helped a lot js can kind of leave you hanging. Great responses ...