I'm trying to find the coordinates (latitude and longitude) from the Google Geocoding API but I can't figure out how to access the properties within the object I am returning. This is the code:
const geoCoor = async function () {
const url = `https://maps.googleapis.com/maps/api/geocode/json?address=${address}&key=${API_KEY}`;
const response = await request.get(url);
return response
};
(async function(){
let data = await geoCoor();
console.log(data.results[0]);
})();
I've tried wrapping it in an IIFE, but when I try to access the array, I am still getting the "undefined" error message.