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.
I believe that the test suite is getting confused because you are replacing the array ownProps. When I modify your code to not use a function call, it works fine.
Still not working with this. What does it consider ‘hard coding’?
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);
}
}
//ownProps = propCheck(canary);
console.log(ownProps); // prints [ "name", "numLegs" ]