Это должно работать:
async function currentPosition() {
const fetchResult = fetch('http://api.open-notify.org/iss-now.json');
const response = await fetchResult;
const data = await response.json();
const { latitude, longitude } = data.iss_position;
initMap(latitude, longitude);
}
function initMap(latitude, longitude) {
let map = new google.maps.Map(document.getElementById('map'), {
center: { lat: latitude, lng: longitude },
zoom: 5,
});
let marker = new google.maps.Marker({
position: { lat: latitude, lng: longitude },
map: map,
});
}
currentPosition();
export { currentPosition, initMap };