Tell us what’s happening:
So question demands 2 thing which are contradictory and wont let the level move ahead.
-
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift")
should return the stringpony
. -
checkObj({pet: "kitten", bed: "sleigh"}, "gift")
should return the stringNot Found
.Your code so far
function checkObj(obj, checkProp) {
// Only change code below this line
var obj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
};
if (obj.hasOwnProperty(checkProp)){
return obj[checkProp];
}
else {
return "Not Found";
}
return "Change Me!";
// Only change code above this line
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36
Challenge: Testing Objects for Properties
Link to the challenge: