Use a Constructor to Create Objects

Use a Constructor to Create Objects
0

#1

This is one of my first coding lessons ever, and am struggling a bit. If someone could give a little hint as to how to do this right I would greatly appreciate it. :slight_smile:

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects


#2

Hello,

In this course you should create an object from Dog class, something like this:

let hound = new Dog();

In this case you have and object from a class that can use in your code.


#3

Hey Ryan,
If this is your first ever coding lesson, then you should start from basics, instead of starting from this challenge.
As far as this challenge is concerned ,

You don’t need this part for challenge, remove it and should be good to go.
Hope it helps.