Doesn't Work Tried Hint In Object Oriented Programming Please Help

Tell us what’s happening:
My code isn’t working

Your code so far


let canary = new Bird("Tweety");
let ownProps = [];
// Add your code below this line
for (let property in canary) {
if (canary.hasOwnProperty(property)) {
  ownProps.push(property);
}
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36.

Challenge: Understand Own Properties

Link to the challenge:

Hello there,

You appear to have deleted some code you should not have. I recommend you reset the challenge, and start again.

Hope this helps

1 Like

You likely just copy and pasted the solution from the hints page, it is missing the constructor function. You can add the Bird constructor back at the top.

function Bird(name) {
  this.name = name;
  this.numLegs = 2;
}

Edit: I added the constructor to the solution.

2 Likes

thank you it made the tests pass

No problem, happy to help. As an added bonus we got the hint solution fixed as well.

Happy coding!

1 Like