Need help with Testing Objects for Properties problem

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

I already opened a post but think I deleted it in error so reposting again.

I have followed the example and the video and also tried all of the postings i can find but noting is working and i am at a loss as to why my code does not work?

  **Your code so far**

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

var checkObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
};

checkObj.hasOwnProperty("gift");
checkObj.hasOwnProperty("pet");
checkObj.hasOwnProperty("sleigh");
checkObj.hasOwnProperty("city")

if (obj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return "NotFound";
}

// Test your code by modifying these values
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift")
 
return "Change Me!";
// Only change code above this line
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36

Challenge: Testing Objects for Properties

Link to the challenge:

This part should be deleted. Why did you add this?

You have a typo here.

Why is this inside of your function?

it was on the example page for the assignment so easy enough to delete but still can’t pass thru.

this code i already had and it matched the video but still errors???

if (obj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return "NotFound";
}

Look again at this part

Here are the instructions again
If not, return "Not Found" .

1 Like

Ohhhhhhhhhhhhhh! such a careless oversite has taken me in circles for hours…

Thank you,

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