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

Adam Dispenza
Adam Dispenza
4,842 Points

JavaScript foundation - prototypes : challenge 1

Hi, Just a bit stumped here as to what I need to do to make this first part work. I thought I assigned the Car constructor 'model' to the carPrototype argument model correctly, but I'm just not getting it, nor is it giving me a valid hint (Always says "Bummer! The Car doesn't have the 'model' set correctly" no matter what I do with the code, including deleting the entire code) . What am I missing?

var carPrototype = { model: "generic", currentGear: 0, increaseGear: function() { this.currentGear ++; }, decreaseGear: function() { this.currentGear--; } }

  function Car() {
    this.model = model;
  }

2 Answers

Hi Adam,

The constructor function takes an argument: Change the name of the argument in the example below so that it works for you.

function Car(argument) {
}
Adam Dispenza
Adam Dispenza
4,842 Points

Thanks, that helped me out!