// Only change code below this line
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
};
function checkObj(checkProp) {
if (myObj.hasOwnProperty(checkProp)) {
return myObj[checkProp];
} else {
return "Not Found"
}
// Only change code above this line
}
console.log(checkObj("city"))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36.
thanks! its just that there is nothing in the prompt on making the list of objects that are required to complete the problem like the city, bed, etc. stuff
I think part of the confusion is that there are tests written by the fcc staff that you don’t see.
For this challenge, you need to write a reusable function so when the tests are being called behind the scenes they run through each of these function calls.
Test cases
Function call 1:checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift")
Functions call 2: checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet")
etc.
On the left it tells you what it calls for the last one example: checkObj({pet: "kitten", bed: "sleigh"}, "gift")
English:
Look in (pet: “kitten”, bed: “sleigh”), and give me what is contained in gift. Which doesn’t exist because it wasn’t included in that search in this case. Even though you do have it in the list.
If it called ({gift: “pony”, pet: “kitten”, bed: “sleigh”}, “gift”) then you would get pony as gift is included.