Testing Objects For Properties help im stuck

Tell us what’s happening:
Describe your issue in detail here.
im stuck on this problem and cant figure out the answer

  **Your code so far**

function checkObj(obj, checkProp) {
// Only change code below this line
if (obj === checkProp){
  return pony;
}else{
  return kitten;
}

// 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:

obj === checkProp

obj is an object, checkProp is a string. So I’m not sure how you expect that check to work?

Did you try using the hasOwnProperty method taught in the challenge? Look at the examples it gives you.


Also, you are hardcoding the return values. You need to return the property on the object by accessing it.

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