Testing Objects for Properties 12/24/21

Tell us what’s happening:
Describe your issue in detail here.
Hello, I can’t get what does this challenge want from me, I get the testing thing but I dunno how am I supposed to have gift and not have in my objects at the same time!

  **Your code so far**

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

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

// 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/96.0.4664.110 Safari/537.36

Challenge: Testing Objects for Properties

Link to the challenge:

You are creating a function that will check if the provided property(this will be passed as 2nd argument while calling the function) is available in the object(this will be passed as 1st argument while calling the function) or not.

You don’t need to create an object in your function.

checkObj({gift: “pony”, pet: “kitten”, bed: “sleigh”}, “gift”)

As you can see in the above function call, 1st argument is the object, and the second argument is the property you need to search for on that object.

I kind of did the same thing at first but i guess i must’ve had a typo or sth, then i saw these objects in my console and got confused -_-.
Thank you very so much. <3 <3

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