1async function printFiles () {
2  const files = await getFilePaths();
3
4  await Promise.all(files.map(async (file) => {
5    const contents = await fs.readFile(file, 'utf8')
6    console.log(contents)
7  }));
8}1  for (const file of files) {
2    const contents = await fs.readFile(file, 'utf8');
3    console.log(contents);
4  }
5 1async function printFiles () {
2  const files = await getFilePaths();
3
4  for (const file of files) {
5    const contents = await fs.readFile(file, 'utf8');
6    console.log(contents);
7  }
8}
91public async Task RunAsync()
2{
3    var tasks = new List<Task>();
4 
5    foreach (var x in new[] { 1, 2, 3 })
6    {
7        var task = DoSomethingAsync(x);
8        tasks.Add(task);
9    }
10 
11    await Task.WhenAll();
12}
131export async function asyncForEach<T>(array: Array<T>, callback: (item: T, index: number) => void) {
2        for (let index = 0; index < array.length; index++) {
3            await callback(array[index], index);
4        }
5    }
6
7await asyncForEach(receipts, async (eachItem) => {
8    await ...
9})
10