Hey guys,
Could someone explain to me what is going on in this code in plain English? I get that it is iterating over the properties and pushing it to an array but can you walk me through the code?
Not looking for the solution. Just trying to understand the code better.
let ownProps = [];
let prototypeProps = [];
for (let property in duck) {
if(duck.hasOwnProperty(property)) { //the hasOwnProperty(property) confuses me
ownProps.push(property);
} else {
prototypeProps.push(property);
}
}
Thank you in advance. I appreciate your help.