Help! I'm frustratedly stuck with this testing objects for properties" test

Please I’m stuck in this “testing objects for properties test”, I’ve done everything humanly possible but can’t seem to get it right.

  **My code so far**

function checkObj(obj, checkProp) {
// Only change code below this line
if (checkObj.hasOwnProperty(checkProp)){
   return checkObj[checkProp];
else {
  return "Not Found";
// 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/91.0.4472.124 Safari/537.36

Challenge: Testing Objects for Properties

Link to the challenge:

Hi @heisemma !

The problem is here

and here

You are not using the obj parameter they gave you.
Instead you are using the function name of checkObj which is incorrect.

You need to use the parameter and then the test will pass.


I’ve tried it, still not working
I changed the "return checkObj[checkProp] " to “return obj[checkProp]”.

Did you change the other one too?

Can you share your updated code?


Ooh I’ve seen the problem, thanks a lot.
I appreciate.

No I did not and that was the problem
Solved it, thanks a lot :handshake:.


I don’t understand this, how is the function using a random object in the code?

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.

Can somebody explain why we use

return checkObj[obj];

instead of

return checkProp[checkObj]?

In the exercise “Accessing Object Properties with Bracket Notation”, if we want to get a property’s value from a function, we enter function[property]. For example, if

const myObj = {
“Space Name”: “Kirk”,


myObj[“Space Name”] = “Kirk”.

So why are we now entering property[value] to get the value in this exercise?

You don’t. That says to get the object from the function? That makes no sense. You want a named property from an object.

That says to get the function from the property. That’s makes no sense.

This is correct.

We are not.

I don’t think that you understand what any of the function arguments are. obj is the object. checkProp is the property. checkObj() is the name of the function.

I think my confusion was not really understanding the difference between the function and object.

obj[checkProp] is the same as MyObj[“Space Name”], except they are different objects and properties.

I was treating checkObj like an object that had obj as its property and checkProp as its value, instead of checkObj as a function with obj as its object and checkProp as its property (yes, in hindsight I should have noticed the variable names made no sense the other way).

Hey you can do that its easy it also took me a bit time but recognised the issue you have create object inside the function for checkObj({gift: “pony”, pet: “kitten”, bed: “sleigh”},
Then the conditional statement but not using the function name use parameters instead
function checkObj( parameter1, parameter2)
First parameter is the obj, and other one is checkprop use logic and update the conditional statement.

how did you do it, i am stuck

HI @exhibit19 !

Welcome to the forum!

If you need help with a challenge, please create a new topic with your code and challenge link and people can assist you there. :+1: