Skip to content

Instantly share code, notes, and snippets.

@gabrielschulhof
Created December 5, 2024 21:36
Show Gist options
  • Save gabrielschulhof/2b5bb8bbc371f41766eb768a86a56650 to your computer and use it in GitHub Desktop.
Save gabrielschulhof/2b5bb8bbc371f41766eb768a86a56650 to your computer and use it in GitHub Desktop.
Async function equivalence
// These two functions are identical.
const fn1 = async () => { return 5 }
const fn2 = () => new Promise((resolve, reject) => {
try {
resolve(5)
} catch (e) {
reject(e)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment