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.
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.