Tell us what’s happening:
i 've just done it but it seems it doesn’t work this way. can anyone please tell me where is the mistake ?
Your code so far
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
// Only change code below this line
if(myObj.hasOwnProperty(checkProp)) {
return myObj[checkProp];
} else {
return "Not Found";
}
}
// Only change code above this line
console.log(checkObj("gift"));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
.
Challenge: Testing Objects for Properties
Link to the challenge: