3 ms·
That's true, but in my experience, they also just memorize the ".then(result =>" pattern and make exactly the same mistake.
by TheCoelacanth 6y ago
That's true, but in my experience, they also just memorize the ".then(result =>" pattern and make exactly the same mistake.
- brundolf 6y agoBut I maintain that in the illustrated case - where you want to get all the different independent values and then combine them at the end - it's actually less ergonomic to do it the wrong way with .then(...) than it is to do it the right way.
- jakear 6y agoMost ergonomic IMO is: const getPeople = async () => (await Promise.all(...)).flat() Without await this would be const getPeople = () => Promise.all(...).then(arrs => arrs.flat()) The difference is slight to be sure, but I usually prefer the await approach.