I have array of links like so:
let array = ['https://1','https://2','https://3']
Than i want to loop all elements and run fetch on them. Still fetch is async so i get request more times i deal this problem removing element from array like so:
array.forEach((link,index) => {
fetch(link, {mode: 'no-cors'}).then(function () {
//more stuff not inportant
}).catch(e => {
console.error('error', e);
});
array.splice(index,1)
})
I wonder is there better solution to solve this ?
Promise.all.