myObj does not need to be declared as objects are passed in the backend to the function checkObj. So various obj for testing the code is automatically passed by the freecodecamp website.
The problem with the code is that function is declared one inside another.
function checkObj(obj, checkProp) {
function checkObj(obj, checkProp) {
return statements
}
}
so the first function checkObj at line 1 is not returning anything. See the below code for reference.
function checkObj(obj, checkProp) {
// Only change code below this line
if(obj.hasOwnProperty(checkProp)){
//console.log(obj[checkProp])
return obj[checkProp]
}
else
return "Not Found"
// Only change code above this line
}