So I came very close to solving this challenge, but gave up and looked at the answer my original code looked like this
function checkObj(obj, checkProp) {
// Only change code below this line
if (obj.hasOwnProperty(checkProp)){
return obj;
}else
return "Not Found";
// Only change code above this line
}
however the actual answer was this
function checkObj(obj, checkProp) {
// Only change code below this line
if (obj.hasOwnProperty(checkProp)){
return obj[checkProp];
}else
return "Not Found";
// Only change code above this line
}
I’m just curious why
return.obj;
isn’t valid and why it needs to be
return.obj[checkProp];
because .obj has already cleared the condition in my if statement of containing checkProp it seems to me returning .obj is the same as returning .obj[checkProp].