Iterate over all Properties-What am I doing wrong?

Tell us what’s happening:
My code looks fine to me. What am I doing wrong?

Your code so far


function Dog(name) {
this.name = name;
}

Dog.prototype.numLegs = 4;

let beagle = new Dog("Snoopy");

let ownProps = [];
let prototypeProps = [];

// Only change code below this line
for (let property in beagle) {
if(Dog.hasOwnproperty(property)) {
  ownProps.push(property);
} else {
  prototypeProps.push(property);
}
}


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:74.0) Gecko/20100101 Firefox/74.0.

Challenge: Iterate Over All Properties

Link to the challenge:

Check your capitalization in hasOwnProperty!

1 Like

No way! That feels so silly! It worked! I can not believe I missed that! I must need to take a nap!

1 Like