Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Do not use forEach with async-await

const players = await this.getWinners();

// BAD
await players.forEach(async (player) => {
  await givePrizeToPlayer(player);
});

await sendEmailToAdmin('All prizes awarded');
Source by gist.github.com #
 
PREVIOUS NEXT
Tagged: #Do #forEach
ADD COMMENT
Topic
Name
6+8 =