Tell us what’s happening:
Your code so far
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
for(let property in Dog){
if(Dog.hasOwnProperty(property)){
ownProps.push(name);
}else{
prototypeProps.push(numLegs);
}
}
console.log(ownProps);
console.log(prototypeProps);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties