The good thing about async is, it speeds up the fetch, and we get whatever is available first instead of server to respond.
But this messes up the ORDER of the requests which in this case is important for me.
I wanted to scrape different parts of a continuous story, so the order is a must.
Here's what I did:
async function getSingle(url) {
await fetch(url).then(function (response) {
return response.text();
}).then(function (html) {
var output = document.querySelector('.output');
output.innerHTML=html;
text += "\n" + document.querySelector('.post-body').innerText;
});
}
It gets everything perfectly, but when I call it for multiple URLs, it returns them unordered.
[Beginner here, so please pardon if it's something really trivial.]