Testing Objects for Properties gift:"pony"

I’ve solved the problem given but the question repeats itself in a way that I should delete gift:“pony” . And the other scenario is that I should add gift:“pony”? I’m very confused at this point please help.

Is there a different way to solve this problem?

  **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";
}
// Only change code above this line
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15

Challenge: Testing Objects for Properties

Link to the challenge:

Do not redefine obj in the function body. You want to work on the obj passed into the function.

That was obvious haha… thanks

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