Created
September 23, 2022 12:31
-
-
Save nikshinde-7/5bd7107f8caf565e883ca868ff254902 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
let value = 1; | |
let promise = Promise.resolve(value); | |
let wrapInPromise = (x) => Promise.resolve(x * 2); | |
const boxResult = await promise.then(wrapInPromise); | |
const wrapperResult = await wrapInPromise(value); | |
console.log(boxResult == wrapperResult); | |
// Should log as true ✅ | |
// Thanks to top-level await 🤓 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment