Please help me,I am stuck

I’ve tried but still

checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "house")

should return the string

Not Found

.

checkObj({city: "Seattle"}, "district")

should return the string

Not Found

.

checkObj({pet: "kitten", bed: "sleigh"}, "gift")

should return the string

Not Found

.
is showing,please help

  **Your code so far**

var myStorage = {
"car": {
  "inside": {
    "glove box": "maps",
    "passenger seat": "crumbs"
   },
  "outside": {
    "trunk": "jack"
  }
}
};

var gloveBoxContents = undefined;
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0

Challenge: Accessing Nested Objects

Link to the challenge:

What is checkObj? Is this the correct challenge?

I guess so,I 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" .

OK, but which challenge are you on? The challenge to which you’ve linked does not seem to match the questions you are asking.

OK, and now can we see the code that you are trying?

function checkObj(obj, checkProp) {
  if(obj.hasOwnProperty(checkProp)) {
    return obj[checkProp];
  } else {
    return "Not Found";
  }
}

done now,my browser had some issues

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