Why is code not passing?

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 = [];

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

   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36.

Challenge: Iterate Over All Properties

Link to the challenge:

Hi @ammarabdelmohsen139 !

You have a syntax error. There is an extra semicolon after the if statement that shouldn’t be there.

I have formatted your code so you can see the error more clearly

for (let property in beagle) {
  if (beagle.hasOwnProperty(property)); {
  } else {
1 Like

Thank you, @jwilkins.oboe , very much!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.