"Not found" problem

Tell us what’s happening:
hey guys,
the code doesn’t return my “Not Found”. instead, it shows undefined

Your code so far


function checkObj(obj, checkProp) {
// Only change code below this line
if (obj.hasOwnProperty) {
  return obj[checkProp];
}
else {

return answer;
}
// Only change code above this line
}
console.log(checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "Amir"))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Testing Objects for Properties

Link to the challenge:

as you never defined the answer variable, what else could it return?

also, hasOwnProperty is a method that you need to call with an argument. This is not doing what you want

obj.hasOwnProperty() is a function, you need to pass it the checkProp as an argument. Also, the variable answer isn’t defined, and should just be the other output if you aren’t returning the checkProp value.