What is the the defect in that code

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

   **Your code so far**

var myObj ={
 gift: "pony",
 pet: "kitten",
 bed: "sleigh",
city: "Seattle"
}
function checkObj(obj, checkProp) {
 // Only change code below this line 
 if (myObj.hasOwnProperty(checkProp)){ return myObj[checkProp]}
else return "Notfound";
 // Only change code above this line
}
   **Your browser information:**

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

Challenge: Testing Objects for Properties

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.


You ore ignoring the function argument obj. You shouldn’t use the global variable at all.

Typos are important.


Side note, it would really help if you used standard formatting for your code when asking for help. It makes it easier to see your logic and the problems.

1 Like