Tell us what’s happening:
Hey everyone,
I don’t know how to incorporate the Seattle code that was provided for this exercise. I haven’t seen anyone post with the Seattle code so my guess is that it is new to the code for this exercise?
Here’s how is how it reads:
checkObj({city: “Seattle”}, “city”) should return “Seattle” .
checkObj({city: “Seattle”}, “district”) should return “Not Found” .
how do I incorporate this into my current code. Thank you!
Your code so far
function checkObj(obj, checkProp) {
// Only change code below this line
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(obj, checkProp) {
if(obj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return "Not Found";
}
}
return "Change Me!"
// Only change code above this line
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36.
Challenge: Testing Objects for Properties
Link to the challenge: