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.
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
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