Google map marker value outside the addListener- Not working

Hi Ionic family,
I’m trying to get the value of marker outside of addListener when marker is dragged by user and don’t know how to call another function inside addListener or get the value outside of the addListener.

TS file source code;

 google.maps.event.addListener(marker, 'dragend', function () {
        console.log(marker.getPosition().lat());
        console.log(marker.getPosition().lng());
      });

Thanks.