Understanding asynchronous javascript

Viewed 66

What is the difference between following piece of codes:

Code 1:

export default async function syncData() {
  await Promise.all([syncData1(), syncData2()]);
}

// called in sagas.js
function* x() {
  const res = yield call(syncData);
}

Code 2:

export default function syncData() {
  return Promise.all([syncData1(), syncData2()]);
}
// called in sagas.js
function* x() {
  const res = yield call(syncData);
}
1 Answers
Related