JSFiddle - React, Tailwind, and code Playground
by Ford Heacock
JavaScript
async function fetchAsync (id) {
let response = await $.get(`https://jsonplaceholder.typicode.com/posts/${id}`);
console.log(response.id)
return response;
}
let ids = [1,2,'z',4];
for (let id in ids) {
fetchAsync(id)
.then(data => console.log(data))
.catch(reason => console.log(reason.message))
}