In this code I am having trouble figuring out this last part of the Code I don't know what it could be yet

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

  **Your code so far**

function checkObj(obj, checkProp) {
// Only change code below this line
var checkObj= {
  gift: "pony",
  pet: "kitten",
  city: "Seattle"
};
if(checkObj.hasOwnProperty(checkProp)){
return checkObj[checkProp];
} else{
return "Not Found";
// Only change code above this line
}
}

**This Is what the last part is asking: (checkObj({pet: "kitten", bed: "sleigh"}, "gift") should return the string Not Found .)

  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36

Challenge: Testing Objects for Properties

Link to the challenge:

What is this doing here?

Basically, you are hard-coding one specific object and only using that object…

But here in the function objects you have obj

which is passed in here when the function is called.

You need to use the function argument obj instead of hard-coding a different object.

1 Like

what does it mean to hard-code?

It means that you are forcing your function to only use one object, the one you create inside of the function, instead of using the function arguments.

1 Like

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