Last active
September 7, 2017 20:15
-
-
Save nomanHasan/ffdec5a720711761e551d4ae1a70ff90 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
// Anatomy of a Async Function | |
exports.some_function = async function(){ | |
try{ | |
// await keyword pauses the execution of the function and returns the resolved value once completed | |
let value = await promise() | |
// Do Something with the Value, it will only get executed after the promise above has been resolved | |
}catch(exception){ | |
// Handles exception | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment