Last active
September 6, 2023 00:30
-
-
Save mcsee/90622aea76933ddedea1fd344dbe4751 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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