I can’t finish this exercise I understand the concept but I can’t translate it into code I don’t understand what the object is and whether it needs to be specified in this exercise and then insert all the parameters to then have them searched by the method, finally I don’t understand or I don’t remember what should I write on the final return
function checkObj(obj, checkProp) {
// Only change code below this line
if (obj.hasOwnProperty(obj,checkProp)) {
return obj[checkProp];
{ else { return "not found";
}
}
return "";
// Only change code above this line
}
}
The first checkForProperty
function call returns true
, while the second returns false
.
Modify the function checkObj
to test if the object passed to the function parameter obj
contains the specific property passed to the function parameter checkProp
. If the property passed to checkProp
is found on obj
, return that property’s value. If not, return Not Found
.
Thanks for your help