Since myObj is not a part of the checkObj function, how can checkProp contain myObj's properties/values when you call myObj[checkProp]? I'm new to learning JS and this is going a bit over my head.
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
if(myObj.hasOwnProperty(checkProp)) {
return myObj[checkProp];
} else {
return "Not Found";
}
}
checkObj("gift");