I believe the exercise is bugged

Tell us what’s happening:

The challenge asks me to return both “pony” and “Not Found” from gift, ive seen the text and video solution, and read the comments and those solutions haven’t worked for me. I guess they are outdated because the challenge didn’t ask for city: “Seattle” two years ago.

Your code so far

function checkObj(obj, checkProp) {
// Only change code below this line
var obj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"

if (obj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return "Not Found"

Your browser information:

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

Challenge: Testing Objects for Properties

Link to the challenge:

You don’t want to be redefining obj in the function body. Get rid of that. The object you are checking is being passed into the function as the first argument.

1 Like