I have the following for-loop:
for await (const account of accountCursor) {
const newAccount = handleAccount(account, migrationService);
try {
await migrationService.accountService.create(newAccount);
} catch (error) {
console.log('Unable to create account');
throw Error(error)
}
}
handleRelatedAccounts(); // call once the for-loop has completed
Once it has finished, I want to call another function. Since it is asynchronous, how can I call the function after the for-loop has finished, not during?