function checkObj(obj, checkProp) {
// Only change code below this line
return “Change Me!”;
// Only change code above this line
}
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 could not find the answers to the questions. can you help?
first you need to check if the object passed to the function has specific property (checkProp). You can use obj.hasOwnProperty(checkProp), if its true return obj[checkProp] and return “Not Found” if its false.