I am unable to solve this logic
checkObj({pet: “kitten”, bed: “sleigh”}, “gift”) should return the string Not Found
I am using the following code:
function checkObj(obj, checkProp) {
// Only change code below this line
// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
myObj.city = "Seattle";
// Your Code Here
let result = "";
if (myObj.hasOwnProperty(checkProp)){
result = myObj[checkProp];
}
else{
result = "Not Found";
}
return result;
// Test your code by modifying these values
// Only change code above this line
}console.log(checkObj("gift"));
you need to have a reusable function, that means you should have a function able to test any object, not just the one you created yourself - so delete the one you created yourself and test the passed in object