Modify the function checkObj
to test if an object passed to the function ( obj
) contains a specific property ( checkProp
). If the property is found, return that property’s value. If not, return "Not Found"
. I sincerely don’t understand what to do.
function checkObj(obj, checkProp) {
var checkProp = {
“House”: “Pink”,
“Church”: “Blue”,
“Mosque”: “Purple”,
“Market”: “Yellow”
};
if (obj === checkProp) {
return “House”;
} else {
return “Not Found”;
}
obj.hasOwnProperty(“House”);
obj.hasOwnProperty(“middle”);
}
console.log(checkObj());
**Your browser information:**
User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36 Edg/98.0.1108.43</code>
**Challenge:** Testing Objects for Properties
**Link to the challenge:**
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties