Tell us what’s happening:
So, since it is forbidden to repeat the topics, and since I havent found a solution in the topics forum, I had to repeat it:
I’m putting the same code as the solution suggested and it doesn’t works, it says it should return “seattle”. I don’t see any seattle in there. Where is my issue?
Your code so far
// Setup
/*var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(obj, checkProp) {
// Only change code below this line
return "Change Me!";
// Only change code above this line
}
checkObj(myObj, "gift");
*/
var myObj = {
gift: 'pony',
pet: 'kitten',
bed: 'sleigh'
};
function checkObj(checkProp) {
// Your Code Here
if (myObj.hasOwnProperty(checkProp) == true) {
return myObj[checkProp];
} else {
return "Not Found";
}
}
// Test your code by modifying these values
checkObj("gift");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
.
Challenge: Testing Objects for Properties
Link to the challenge: