I really don't know what is wrong here

Tell us what’s happening:

Your code so far


function Dog(name, color) {
this.name= 'jim';
this.color='gold';
this.numLegs=4;
}
let terrier= new Dog("Dwight", "Black");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0.

Challenge: Extend Constructors to Receive Arguments

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments

well if you watch your constructor function it has some default values like "jim" and "gold" so it s not flexible at all since all instances will have the same name and color.When you create a new Dog you need to take advantage of arguments you pass so it will reflect in your code. So this.name and this.color need to be changed.

This is the correct code

function Dog(name, color) {
  this.name = name;
  this.color = color;
  this.number = 4;
}
let terrier = new  Dog("Dwight",  "Black")
1 Like

Hey there,

your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, if you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

Also please do not bump old topics.

Thank you.

sorry, I will take care of it

1 Like

exactly. the initial code has some default values, thereby defeating the purpose of the constructor function