JavaScript: Testing Objects for Properties can't figure out what I'm missing

Tell us what’s happening: when I run the test it checks off everything except
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift") should return "pony" .
but if i delete pet: “pony” it won’t check off

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

I can’t figure it out I think they contradict each other

Your code so far


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

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

// Only change code above this line


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15.

Challenge: Testing Objects for Properties

Link to the challenge:

Hi @jonathan7135. Welcome to FCC.
You are supposed to use the parameter obj in the body of the function like:

function checkObj(obj, checkProp) {
// Only change code below this line
if(obj.hasOwnProperty(checkProp)) {
     return obj[checkProp];
  } else {
      return "Not Found";
   }   
}

what happens is that if i remove gift: “pony” it checks off the last test and un checks the first and if i add it back it checks of the first and un checks the last

function checkObj(obj, checkProp) {
// Only change code below this line
return “Change Me!”;
// Only change code above this line
}

this is the starting code for it

i got that from the youtube video

if i don’t add that none of the test check off

basically what i think happens the first test feeds gift and gets back pony and it checks it off but the last test feeds gift and it wants back not found so it doesn’t pass but if I delete gift: “pony” part of the code i get the opposite result first test fails last passes

i figured it out I had obj with capital Obj thank you.