I've been reading everything I can about async/await and Promises, but I can't quite get it to work. I keep getting 'Promise ' and when it's fulfilled I receive 'Undefined'.
I think I've spent about two days on this! I'm not sure what's wrong. Here's the un-promisified version.
const getCoords = (address) => {
geocoder.addressSearch(address, (result) => {
return result;
}
);
};
And here is my attempt at the promised code:
const getCoords = async (address) => {
await geocoder.addressSearch(address, async (result) => {
return result;
}
);
};
I'm just trying to return the result. If anyone could steer me in the right direction it would be really appreciated.