Tell us what’s happening:
Got all checks passed except the one
checkObj({pet: "kitten", bed: "sleigh"}, "gift")
should return "Not Found"
.
I guess I have to check it once and then remove the ‘pony’ from the object. so it will get a not found
tried to do delete myObj[“pony”];
but that diden’t work.
Your code so far
function checkObj(obj, checkProp) {
// Only change code below this line
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle",
};
if (myObj.hasOwnProperty(checkProp)){
return obj[checkProp];
}
else {
return "Not Found";
}
// Only change code above this line
}
Challenge: Testing Objects for Properties
Link to the challenge: