Tell us what’s happening:
Your code so far
// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
// Your Code Here
var result = ""
if(myObj.hasOwnProperty(checkProp)){
result = myObj[checkProp];
console.log(result)
}
else {
result = "Not Found";
}
return result
}
// Test your code by modifying these values
checkObj("gift");
Your browser information:
User Agent is: Mozilla/5.0 (Linux; U; Android 8.1.0; TECNO B1p Build/O11019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.75 Mobile Safari/537.36 OPR/51.0.2254.150807
.
Challenge: Testing Objects for Properties
Link to the challenge: