Testing Object for Properties Issue

Tell us what’s happening:

Hello, I have inputed this code, but it states that gift, pet, bed, city are not defined. How would I go about defining these values and thereby allowing the rest of my code to function.

Your code so far



// Only change code below this line
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh",
  city: "Seattle"
};


function checkObj(checkProp) {
if(myObj.hasOwnProperty(checkProp)) {
  return myObj[checkProp];

} else 
  return "Not Found";
}
console.log(checkObj());
// Only change code above this line


Your browser information:

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

Challenge: Testing Objects for Properties

Link to the challenge:

If you got that from the video, it’s outdated. The current starter code for the problem looks like this:

function checkObj(obj, checkProp) {
  // Only change code below this line
  return "Change Me!";
  // Only change code above this line
}
1 Like