Testing Objects for Properties - info in editor missing!

Tell us what’s happening:

The console refers to all these properties: gift, pet, bed, none of which are present in the editor. It looks like the editor is missing the information.

  **Your code so far**

function checkObj(obj, checkProp) {
// Only change code below this line

if (obj(hasOwnProperty(checkProp))) {
  return [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; rv:85.0) Gecko/20100101 Firefox/85.0.

Challenge: Testing Objects for Properties

Link to the challenge:

no information is missing, you need to create a function that accepts an object and a string and check if the object has a property with the name equal to that string, the tests then check with some random input

here you have a syntax issue, that’s making your code fail

Thanks for getting back so quickly. Should that be:

 if (obj.hasOwnProperty(checkProp)) {

If so, there’s still no properties to pull from so I’m not sure how it can kick out a correct answer…the console says:

// running tests
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift") should return "pony".
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet") should return "kitten".
checkObj({city: "Seattle"}, "city") should return "Seattle".
// tests completed

But none of that info is in the editor window

What do you think fuction will/should return?

Ah I see what you’re getting at. Instead of checkProp I should be putting in a property such as city or pet etc.

That would surely require the parameters city, pet, gift etc to exist though? Which they don’t

when this is called the parameter checkProp has value of "gift", you don’t need those

what is it that the function should return?

I’m slowly getting there, thank you. The function is supposed to return the value of checkProp.

I’m not sure how to make that happen to be honest

you learned not many challenges ago how to access an object property with a variable, if you don’t remember it, you can go back to review

I think it was val[checkProp] that I needed

I don’t think you have a variable named val