learn javascript from freecodecamp, when i reach object, they teach about bracket notation and dot notation, when i use dot notation in return obj.checkProp like below code
function checkObj(obj, checkProp) {
  // Only change code below this line
if (obj.hasOwnProperty(checkProp)) {
  return obj.checkProp;
}
else return "Not Found";
  // Only change code above this line
}
console.log(checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet"));
the return is undefied
but when i use bracket notation in return obj[checkProp]
function checkObj(obj, checkProp) {
  // Only change code below this line
if (obj.hasOwnProperty(checkProp)) {
  return obj[checkProp];
}
else return "Not Found";
  // Only change code above this line
}
console.log(checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet"));
it return kitten.
my question is why the dot is not working but the bracket is working
 
    