by sim0n · 9y ago · 0 comments
One of the best things about JS/Node is that you can wait on I/O from different sources at the same time and since the async/await syntax is just sugar over Promises, you can do things like:
const [user, notifications, messages] = await Promise.all([
getUser(),
getNotifications(),
getMessages(),
]);
Instead of having to wait on I/O sequentially like: const user = getUser();
const notifications = getNotifications();
const messages = getMessages();
if awaiting were implicit.