I need help scalling through: Testing Objects for Properties

Tell us what’s happening:
Describe your issue in detail here.

I need help answering the question, I have tried several ways to no avail. please help
“Modify the function checkObj to test if an object passed to the function ( obj ) contains a specific property ( checkProp ). If the property is found, return that property’s value. If not, return "Not Found" .”

  **Your code so far**

function checkObj(obj, checkProp) {
// Only change code below this line
const checkObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle",
house: "",
district: "",

};


obj.hasownProperty("pony", "kitten","sleigh");
checkProp.hasownProperty("Seattle", "district", "house");
  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:99.0) Gecko/20100101 Firefox/99.0

Challenge: Testing Objects for Properties

Link to the challenge:

these two lines on their own do nothing (also the method is hasOwnProperty - capitalization matter, and it takes only one argument)

your function just always return "Not Found"

what are you doing with this object?
the function is passed an object when it is called

function checkObj(obj, checkProp) {

  // Only change code below this line

    return "Not Found";

  }

  // Only change code above this line

when I run the test with the answer above. it still won’t accept it?

return “Not Found”

not accepted?

help!

Hi @femmydinno !

Right now your function is only returning Not Found.

But if the property is found you need to return the property’s value.

You will need to write a condition to check if the property is there or not.
Then you will return the appropriate values.

Hope that helps!

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