So my question is this.
I know this is the syntax for(prop in obj), but does the computer recognize the properties because of the constructor?
so the computer sees the curly braces {} knows it’s an object and hence it knows its a property and not just a random variable?
**Your code so far**
function Bird(name) {
this.name = name;
this.numLegs = 2;
}
let canary = new Bird("Tweety");
let ownProps = [];
// Only change 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36
Challenge: Understand Own Properties
Link to the challenge: