--- id: 587d7dad367417b2b2512b77 title: Define a Constructor Function challengeType: 1 videoUrl: '' localeTitle: Определение функции конструктора --- ## Description
Constructors - это функции, которые создают новые объекты. Они определяют свойства и поведение, которые будут принадлежать новому объекту. Подумайте о них как о плане создания новых объектов. Вот пример constructor :
функция Bird () {
this.name = "Альберт";
this.color = "blue";
this.numLegs = 2;
}
Этот constructor определяет объект Bird с name свойств, color и numLegs установленными на Albert, blue и 2, соответственно. Constructors следуют нескольким соглашениям:
## Instructions undefined ## Tests
```yml tests: - text: Dog должно быть свойство name заданное в строке. testString: 'assert(typeof (new Dog()).name === "string", "Dog should have a name property set to a string.");' - text: '' testString: 'assert(typeof (new Dog()).color === "string", "Dog should have a color property set to a string.");' - text: Dog должно быть свойство numLegs заданное числом. testString: 'assert(typeof (new Dog()).numLegs === "number", "Dog should have a numLegs property set to a number.");' ```
## Challenge Seed
```js ```
## Solution
```js // solution required ```