I’m new to asynchronous Javascript and can’t figure out how to return a fetched html page as a string. All that is being returned is a promise, which I have tried to access with .then(), but have had no luck. Here is what I’m working with:
Your getHtml() function looks fine to me (assuming you are replacing 'url' with an actual url). You are correct, it will return a Promise because all functions declared with async return a Promise. So you need to handle that correctly. Can you give us an example of how you are using this function in your code?