Tell us what’s happening:
what is wrong with my code as this specific error keeps coming up
checkObj({pet: "kitten", bed: "sleigh"}, "gift")
should return "Not 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";
}
// Only change code above this line
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36
.
Challenge: Testing Objects for Properties
Link to the challenge:
Summary
This text will be hidden