Hello,
The first test " checkObj("gift")
should return "pony"
." passed for this, but the second and third test, respectively for “pet” and "house doesn’t. Could someone explain to me why this is without giving me the answer. I think the syntax is correct, however, perhaps I am getting concept wrong.
I’d feel better had I got them all wrong because there wouldn’t had been the outlier. Could someone give me some feedback as to what concepts/materials I should be looking into to solve this.
<p>// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
// Your Code Here
if(myObj.hasOwnProperty("gift")){
return "pony";
}
else if(myObj.hasOwnProperty("pet")){
return "kitten";
}
else if(myObj.hasOwnProperty("bed")){
return "sleigh";
}
else{
return "Not Found";
}
};
// Test your code by modifying these values
checkObj("pet");</p>