Objects for properties cannot pass the test

I am not passing all the tests


var obj = {
 gift: "pony",
 pet: "kitten",
 bed: "sleigh",
 city: "Seattle"
}

function checkObj(checkProp) {
var answer = ""
if(obj.hasOwnProperty(checkProp)){
  answer = obj[checkProp]
}  else {
  answer =  "Not Found"
}

return answer;
}

console.log(checkObj("gift"));

Link to the challenge:

1 Like

Hello!

It looks like you’ve changed the parameters of the function declaration provided by the challenge. I would suggest resetting the lesson to write the code as suggested by the challenge, or you can add obj back in as a parameter, and your code should pass as is.

Hope this helps!

3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.