Fetch API + for of + async/await
we would not be using Promise.all and Promises chaining
API Link: JSON Placeholder
const urls = [
'https://jsonplaceholder.typicode.com/users',
'https://jsonplaceholder.typicode.com/posts',
'https://jsonplaceholder.typicode.com/albums',
];
async function getDatafromAPI(){
const dataInArray = urls.map(url=>fetch(url));
for await (let data of dataInArray){
const dataConvetedtoObject=await data.json()
console.log(dataConvetedtoObject)
}
}
getDatafromAPI()
Result
Thankyou for Reading,