Understand Own Properties what's the point of hasOwnProperty

Tell us what’s happening:
Hi, I don’t understand what is the point of “hasOwnProperty” in this challenge
for (let x in canary) ownProps.push(x) - this code passed the challenge, and I’m lost about what exactly “hasOwnProperty” adds to the code in this situation

For me it seems like we use for…in loop to loop through properties of the object, then we are supposed to check if these properties exist with “hasOwnProperty”, and then add them to new array, which doesn’t make sense?

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 x in canary) ownProps.push(x)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0.

Challenge: Understand Own Properties

Link to the challenge: