freeCodeCamp Challenge Guide: Use a Constructor to Create Objects

Use a Constructor to Create Objects

Problem Explanation

We saw in the last challenge how to create a constructor function. Now we can simply call this function to create a new object with the properties already defined in the constructor. Simply initialise a new variable hound calling the Dog() constructor.


Solution 1 (Click to Show/Hide)
function Dog() { = "Rupert";
  this.color = "brown";
  this.numLegs = 4;
// Add your code below this line
let hound = new Dog();

Please change the link to ‘Get a Hint’ in this challenge, as it is refered to , which “does not exist or is private”