Tell us what’s happening:
the test says that ownProps must not be ‘hardcoded’. It doesn’t look hardcoded to me. Please tell me what in my code qualifies as hardcoded?
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
function propCheck(obj){
let funcProp = [];
for (let property in obj) {
if(obj.hasOwnProperty(property)) {
funcProp.push(property);
}
}
return funcProp;
}
ownProps = propCheck(canary);
console.log(ownProps); // prints [ "name", "numLegs" ]
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0
.
Challenge: Understand Own Properties
Link to the challenge: