Tell us what’s happening:
Hello I’ve solved the problem, but essentially don’t understand the problem what its asking or how this method works. Could someone explain it in detail for me please!
Your code so far
function checkObj(obj, checkProp) {
// Only change code below this line
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
}
if (myObj.hasOwnProperty(checkProp)) {
return myObj[checkProp];
} else
return "Not Found";
// Only change code above this line
}
console.log(checkObj())
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
.
Challenge: Testing Objects for Properties
Link to the challenge: