I have declared variable at global level in function, which eventually get changed within inner function and I want to return changed variable value as outer function's value but currently getting undefined.Plz provide guidance.

```
function checkResult(req){
    let result = true;
    Reservation.find({result_date: req.body.res_date}, function (err,doc) {
        if (err) {console.log(err);}
        else if (reservations) {
         result = false;
         console.log(result);       
        }
    })
    console.log("Final:");
    return result; // undefined error
}

```