return "Not Found";

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) {
 if (myObj.hasOwnProperty(checkProp)){
   return myObj [checkProp];
else if(myObj.hasOwnProperty(checkProp) !== false){
return "Not Found";
return "Not Found";
 // Test your code by modifying these values

   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 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 shouldn’t use myObj. You need to use the function argument obj.

Hi @mekki !

Welcome to the forum!

As mentioned, you shouldn’t create your own object here.
Delete this

Reason being is because you want your function to work for ANY object.
Not just one you created.
What if you had to test your function against 100 objects?
Are you going to code 100 different objects just to pass the test?
No, that is not practical :grinning:

When you call the function, that is when you pass in an actual object

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

Now, your code should pass once you delete that object you created and use the correct parameter name .

Hope that helps!

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