checkObj({pet: "kitten", bed: "sleigh"}, "gift") should return the string Not Found

I need a solution to the last problem.
I have goten all the answers right, except the last one = checkObj({pet: “kitten”, bed: “sleigh”}, “gift”) should return the string Not Found.

  **Your code so far**

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

  return obj[checkProp];

return "Not Found";
// Only change code above this line
  **Your browser information:**

Challenge: Testing Objects for Properties

Link to the challenge:

Hello! Welcome to the community :grin:!

The solution is right and wrong at the same time :sweat_smile:.

For one, you must not change/reassign the obj variable inside your function, otherwise you’re cheating :stuck_out_tongue:. The tests to check that your project works will test the function and pass their own obj.

In short, remove the var obj = ({gift...}).

Why are you redefining this obj variable?

1 Like

It worked!.
Thank you very much.

1 Like

Thanks for helping.

I have solved the problem.

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