Hi guys, I’m having a hard time with this lesson: Basic JavaScript: Testing Objects for Properties.
My not working solution is:
function checkObj(obj, checkProp) {
// Only change code below this line
var obj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
if (obj.hasOwnProperty(checkProp)) {
return obj[checkObj];
} else {
return "Not Found";
}
// Only change code above this line
}
console.log(checkObj.hasOwnProperty("gift"));--> false
console.log(checkObj("gift")); --> Not Found
Anyone could help me, please?
Challenge: Testing Objects for Properties Link to the challenge: