Basic JavaScript - Testing Objects for Properties

Tell us what’s happening:
help me through please

Your 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/115.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Testing Objects for Properties

Link to the challenge:

You should return the ‘obj’ function parameter’s value, not the function from inside itself.:

`return checkObj[checkProp];`

Also, the ‘If’ statement should check if the ‘obj’ has its own property, not the function:

how should it be i am not getting anything still

What did you try to fix ?

These are the only two variables you need to use.

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

Please don’t hijack other people’s topics. Thanks

Maybe if you analyze the following example, you will get closer to the real issue in your code:


This is just guidance.

2 Likes

thanks i now got the point i was missing

1 Like

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