Https://forum.freecodecamp.org/c/421

I am trying to do the exercice using the property hasOwnProperty .
i did this code bellow but i only getting Not Found as a result.
obj.hasOwnProperty(“checkProp”) returns always false

  **Your code so far**

function checkObj(obj, checkProp) 
{
  if (obj.hasOwnProperty("checkProp"))
    {
      return obj[checkProp];
    }
  else
    {
        return "Not Found";
    }
}
  **Your browser information:**

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

Challenge: Testing Objects for Properties

Link to the challenge:

Hi @naimmaouche1988 !

Pay close attention to this line here

What this is currently saying is if the object has a property called “checkProp”.

If were to try this function call here, we can see there is no “checkProp” property in this object

checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift")

You need to change that line so it tests the parameter of checkProp and not the string.

Once you fix that then the test will pass

waw, very clever . you saved my life . thank you so much