curriculum/challenges/english/blocks/object-oriented-programming/587d7dad367417b2b2512b77.md
<dfn>Constructors</dfn> are functions that create new objects. They define properties and behaviors that will belong to the new object. Think of them as a blueprint for the creation of new objects.
Here is an example of a constructor:
function Bird() {
this.name = "Albert";
this.color = "blue";
this.numLegs = 2;
}
This constructor defines a Bird object with properties name, color, and numLegs set to Albert, blue, and 2, respectively. Constructors follow a few conventions:
Create a constructor, Dog, with properties name, color, and numLegs that are set to a string, a string, and a number, respectively.
Dog should have a name property set to a string.
assert(typeof new Dog().name === 'string');
Dog should have a color property set to a string.
assert(typeof new Dog().color === 'string');
Dog should have a numLegs property set to a number.
assert(typeof new Dog().numLegs === 'number');
function Dog (name, color, numLegs) {
this.name = 'name';
this.color = 'color';
this.numLegs = 4;
}