1const mapLoop = async _ => {
2 console.log('Start')
3
4 const promises = fruitsToGet.map(async fruit => {
5 const numFruit = await getNumFruit(fruit)
6 return numFruit
7 })
8
9 const numFruits = await Promise.all(promises)
10 console.log(numFruits)
11
12 console.log('End')
13}
1const someFunction = (myArray) => {
2 const promises = myArray.map(async (myValue) => {
3 return {
4 id: "my_id",
5 myValue: await service.getByValue(myValue)
6 }
7 });
8 return Promise.all(promises);
9}
10