I am stuck for a while with this, please someone should help. Thanks

function checkObj(obj, checkProp) {

  // Only change code below this line

  var checkObj = {

  gift: "pony",

  pet: "kitten",

  bed: "sleigh",

  city: "Seattle",

};

if(checkObj.hasOwnProperty(checkProp)) {

  return checkObj[checkProp];

} else {

 // Only change code above this line

  return "Not Found";

}

  // Only change code above this line

}

After running the above, this is the error message that I got: checkObj({pet: "kitten", bed: "sleigh"}, "gift") should return "Not Found" .

There is no need to declare an object (checkObj) inside the checkObj function. The first argument passed to the function is the one you are supposed to be checking. Each test may have a different object that is passed, so you can not hard code the object to get the correct answer for all tests.

1 Like

It worked, Thanks a lot.