Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active September 6, 2023 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/90622aea76933ddedea1fd344dbe4751 to your computer and use it in GitHub Desktop.
Save mcsee/90622aea76933ddedea1fd344dbe4751 to your computer and use it in GitHub Desktop.
function asyncFunc1() {
return new Promise((resolve, reject) => {
// Async operation
// ...
// If successful
resolve(result1);
// If error
reject(error);
});
}
function asyncFunc2() {
return new Promise((resolve, reject) => {
// Async operation
// ...
// If successful
resolve(result2);
// If error
reject(error);
});
}
async function performAsyncOperations() {
try {
const result1 = await asyncFunc1();
const result2 = await asyncFunc2();
const result3 = await asyncFunc3();
// Continue with further operations
} catch (error) {
console.log(error);
}
}
performAsyncOperations();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment