Function returning Undefined [duplicate]

here I want to return value and want to use this outside but it returns undefined

I have tried to solve but failed so i want to this to solve


const d= navigator.geolocation.getCurrentPosition(function(position){


    const t=position.coords;

    return t;
})
const f=d;
console.log(f)