
The array.map(x => await act(x)) Promise Headache
What is going on here?
todo: these are just some notes...
array.map(async (x) => await act(x))
returns an array of resolved promises, not an array of the result of act(x)
, which is what I would expect.
javascript
1const actions = array.map((x) => act(x));
2const result = await Promise.all(actions);
3
4//or
5const result = await Promise.all(array.map((x) => act(x)));