Object Oriented Programming: Use a Constructor to Create Objects

pls i need some help with this challenge: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects

my code is

function Dog() {
this.name = “Rupert”;
this.color = “brown”;
this.numLegs = 4;
}
// Add your code below this line
let redDog = new Dog();

redDog.name = “mark”;
redDog.color = “red”;
redDog.numLegs = 40;

The instructions specify that you must use the name “hound” for the new instance of your Dog() class.

Also when you post your code samples please wrap them in triple backticks ```
And that makes your code a lot easier to read

function Dog() {
  this.name = "Rupert";
  this.color = "brown";
  this.numLegs = 4;
}
// Add your code below this line
 let hound = new Dog();

 hound.name = "mark";
 hound.color = "red";
 hound.numLegs = 40;

its working now…thank you

1 Like