--- id: 587d7daf367417b2b2512b7d title: Iterate Over All Properties challengeType: 1 videoUrl: '' localeTitle: Итерация по всем свойствам --- ## Description
Теперь вы видите два вида свойств: own свойства и свойства prototype . Own свойства определяются непосредственно на самом экземпляре объекта. И prototype определены на prototype .
функция Bird (name) {
this.name = name; //собственность
}

Bird.prototype.numLegs = 2; // свойство прототипа

пусть утка = новая птица («Дональд»);
Вот как вы добавляете own свойства duck к массиву ownProps и свойства prototype для массива prototypeProps :
let ownProps = [];
let prototypeProps = [];

для (пусть свойство в утке) {
if (duck.hasOwnProperty (свойство)) {
ownProps.push (свойство);
} else {
prototypeProps.push (свойство);
}
}

console.log (ownProps); // печатает ["name"]
console.log (prototypeProps); // печатает ["numLegs"]
## Instructions
Добавьте все own свойства beagle в массив ownProps . Добавьте все свойства prototype Dog в массив prototypeProps .
## Tests
```yml tests: - text: Массив ownProps должен содержать "name" . testString: 'assert(ownProps.indexOf("name") !== -1, "The ownProps array should include "name".");' - text: Массив prototypeProps должен содержать "numLegs" . testString: 'assert(prototypeProps.indexOf("numLegs") !== -1, "The prototypeProps array should include "numLegs".");' - text: 'Решите эту задачу, не используя встроенный метод Object.keys() .' testString: 'assert(!/\Object.keys/.test(code), "Solve this challenge without using the built in method Object.keys().");' ```
## Challenge Seed
```js function Dog(name) { this.name = name; } Dog.prototype.numLegs = 4; let beagle = new Dog("Snoopy"); let ownProps = []; let prototypeProps = []; // Add your code below this line ```
## Solution
```js // solution required ```