Created
December 5, 2024 21:36
-
-
Save gabrielschulhof/2b5bb8bbc371f41766eb768a86a56650 to your computer and use it in GitHub Desktop.
Async function equivalence
This file contains hidden or 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
// 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