Can anyone tell me where i went wrong? Stuck!
Tell us what’s happening:
Your code so far
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
};
function checkObj(obj,checkProp) {
// Your Code Here
if (myObj.hasOwnProperty(checkProp)) {
return myObj[checkProp];
}
else
return "Not Found";
}
// Test your code by modifying these values
console.log(checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift"));
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36
.
Challenge: Testing Objects for Properties
Link to the challenge: