Please help me to solve this code

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
 var checkProp = {
   gift: "pony",
   pet: "kitten",
   bed: "sleigh",

 }
 return "Change Me!";
checkProp.hasOwnProperty("gift");
 checkProp.hasOwnProperty("house");
 // 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/103.0.0.0 Safari/537.36

Challenge: Testing Objects for Properties

Link to the challenge:

For this problem, you are using the ‘hasOwnProperty’ method to check whether a certain property exists in a obj. Here are some things I would suggest to you to help you to solve this problem.

  • You are being supplied an object as parameter obj and you need to check if it has a string property as checkProp

  • checkProp is a string so it must use bracket notation to access the property.

  • The ‘hasOwnProperty’ returns a boolean value that states whether a property is true or false

If this doesn’t help you, please respond so I can help some more.

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