CANNOT SOLVE Testing objects for properties

Tell us what’s happening:
I have tried to solve this problem by consulting several different posts. I’ve followed along with the video and copied the video code VERBATIM, and it still does not work.

I have the feeling that something has been left out of this exercise which is making it impossible to solve.

Your code so far


function checkObj(obj, checkProp) {
// Only change code below this line
return "Change Me!";
// 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/80.0.3987.163 Safari/537.36.

Challenge: Testing Objects for Properties

Link to the challenge:

Hello,

You have to check with Object.hasOwnProperty if there is property in object. If property exist return that property or “Not Found” if it doesn’t exist.

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.

2 Likes

If you share your code with us, we can help you figure out what is wrong.

Keep in mind that many freeCodeCamp challenges change over time as we try to make them more effective teaching tools. Whenever you see someone else’s solution, you need to look at it critically and see if you need to adapt the solution to solve your problem.

1 Like

Hi,
thank you for the suggestions. I checked some of the code again adn was able to make it work. I think that the error hints on the screen are misleading, as they refer to information not provided in the challenge.

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

Passed

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

Passed

checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "house") should return "Not Found" .

Passed

checkObj({city: "Seattle"}, "city") should return "Seattle" .

Passed

checkObj({city: "Seattle"}, "district") should return "Not Found" .

The tests are listed under the challenge description to allow you to use them to help you understand the challenge.

What information do you think that they depend on that isn’t in the challenge?