Hello,
I am stuck on the following 2 objects returning “Not Found”
I have to imagine there is a simple solution here, but as a I am new to this, I really have no idea how to return “House” and “District” as “Not Found”
The 2 tests that have failed are:
- checkObj({gift: “pony”, pet: “kitten”, bed: “sleigh”}, “house”)` should return “Not Found” .
- checkObj({city: “Seattle”}, “district”) should return “Not Found”.
Any help would be appreciated.
Thank you!
function checkObj(obj, checkProp) {
// Only change code below this line
var checkObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
};
if(checkObj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return "Not found";
}
// Only change code above this line
}