promise.all fetch code example
Example: fetch multiple urls javascript
async function getAllUrls(urls) {
try {
var data = await Promise.all(
urls.map(
url =>
fetch(url).then(
(response) => response.json()
)));
return (data)
} catch (error) {
console.log(error)
throw (error)
}
}