1var arr = [1, 2, 3, 4, 5];
2
3var results: number[] = await Promise.all(arr.map(async (item): Promise<number> => {
4 await callAsynchronousOperation(item);
5 return item + 1;
6}));
7
1let obj = {
2 one: 1,
3 two: 2,
4 three: 3
5}
6
7obj.map((element, index) => {
8 // do something
9 // return result
10});
11
12/*
13 map() is a higher order function (a function that takes another
14 function as a parameter) and as such is synchronous
15*/