The solution works, but I'm still getting errors

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function checkObj(obj, checkProp) { 
// Only change code below this line
console.log(obj);
if (myObj.hasOwnProperty(checkProp)) {
  return myObj[checkProp];
} else {
  return "Not Found";
}
// Only change code above this line
}

var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
};
console.log(checkObj(myObj, "gift"));
console.log(checkObj(myObj, "pet"));
console.log(checkObj(myObj, "bed"));
console.log(checkObj(myObj, "name"));

myObj = {
city: "Seattle",
};
console.log(checkObj(myObj, "city"));
console.log(checkObj(myObj, "district"));
console.log(checkObj(myObj, "gift"));

  **Your browser information:**

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

Challenge: Testing Objects for Properties

Link to the challenge:

You’ve hard-coded myObj but you need to use obj.

1 Like

Thank you! The change has been made.

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