Testing Objects for properties need help

Tell us what’s happening:
Describe your issue in detail here.
what’s the issue with this ?

  **Your code so far**

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

Challenge: Testing Objects for Properties

Link to the challenge:

In this line, you are checking if checkObj (which is a function) has the property named "obj". Does this match the instructions?

Then here you check if checkObj (again, the function) has the property named checkProp (not the property with the name stored in the variable checkProp)

No matter what happens on the previous two lines though, you always return the same string.

Hi @duet.jack !

I think it would be easier to reset the lesson.

Your task is to check if obj has a property of checkProp.
If so, then return that property’s value.
If not, then return Not Found

Hint: An if/else statement would be good here

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