--- id: 587d7dad367417b2b2512b78 title: Use a Constructor to Create Objects challengeType: 1 forumTopicId: 18233 dashedName: use-a-constructor-to-create-objects --- # --description-- Here's the `Bird` constructor from the previous challenge: ```js function Bird() { this.name = "Albert"; this.color = "blue"; this.numLegs = 2; } let blueBird = new Bird(); ``` **NOTE:** `this` inside the constructor always refers to the object being created. Notice that the `new` operator is used when calling a constructor. This tells JavaScript to create a new instance of `Bird` called `blueBird`. Without the `new` operator, `this` inside the constructor would not point to the newly created object, giving unexpected results. Now `blueBird` has all the properties defined inside the `Bird` constructor: ```js blueBird.name; blueBird.color; blueBird.numLegs; ``` Just like any other object, its properties can be accessed and modified: ```js blueBird.name = 'Elvira'; blueBird.name; ``` # --instructions-- Use the `Dog` constructor from the last lesson to create a new instance of `Dog`, assigning it to a variable `hound`. # --hints-- `hound` should be created using the `Dog` constructor. ```js assert(hound instanceof Dog); ``` Your code should use the `new` operator to create an instance of `Dog`. ```js assert(code.match(/new/g)); ``` # --seed-- ## --seed-contents-- ```js function Dog() { this.name = "Rupert"; this.color = "brown"; this.numLegs = 4; } // Only change code below this line ``` # --solutions-- ```js function Dog() { this.name = "Rupert"; this.color = "brown"; this.numLegs = 4; } const hound = new Dog(); ```