'Testing Objects for Properties' Help

Tell us what’s happening:
I’m passing all of the tests except for :
checkObj({pet: "kitten", bed: "sleigh"}, "gift")

This is returning ‘pony’ in the console, what is my error here?

  **Your code so far**

var myObj = {
gift: 'pony',
pet: 'kitten',
bed: 'sleigh',
city: 'Seattle'
};

function checkObj(obj, checkProp) {
if(myObj.hasOwnProperty(checkProp)) {
  return myObj[checkProp];
} else {
  return 'Not Found';
}



}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:86.0) Gecko/20100101 Firefox/86.0.

Challenge: Testing Objects for Properties

Link to the challenge:

Why are you referencing myObj?

You need to check the function argument obj.

Ah! I see my error. Thank you for your response!

1 Like

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