Skip to content

Instantly share code, notes, and snippets.

@nikshinde-7
Created September 23, 2022 12:31
Show Gist options
  • Save nikshinde-7/5bd7107f8caf565e883ca868ff254902 to your computer and use it in GitHub Desktop.
Save nikshinde-7/5bd7107f8caf565e883ca868ff254902 to your computer and use it in GitHub Desktop.
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