Understand Own Properties Challenge

Tell us what’s happening:

I think I’m on the right track with this code but I don’t know what’s wrong can you please help me?.

Please find the code below of what I’ve done

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_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Understand Own Properties

Link to the challenge:

is this the whole code in the editor? or do you have something else in the editor that you have not reported in the post?

This is my code for in relation to this challenge.

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 code is fine. Make sure you don’t remove anything from the code provided. Simply code your answer where it is supposed to be. I think you removed

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

from the code provided.

What did I do wrong what’s the best way for me to pass this challenge?

Is this what you have before submitting

function Bird(name) {
  this.name = name;
  this.numLegs = 2;
}
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);
}
}

Yes it was where have I gone wrong?