I have a function that fires up request multiple times, but need to add delay between each so that I don't spam the server:
async function multiReq(iterationNr){
for (let i=0; i++; iterationNr ) {
//send request here
res.push(resultOfTheRequest);
}
return res;
};
console.log(multiReq(10));
Where should I have timeout so that I have e.g. req 1, wait 1 sec, req 2, wait 1 sec until finished and then return res array?