Skip to content

Instantly share code, notes, and snippets.

@yefim
Created January 23, 2019 05:56
Show Gist options
  • Save yefim/92e730b4612aa5337cd2fcfe72d2c688 to your computer and use it in GitHub Desktop.
Save yefim/92e730b4612aa5337cd2fcfe72d2c688 to your computer and use it in GitHub Desktop.
const promiseOrCallback = (cb) => {
if (cb) {
cb('callback');
} else {
return Promise.resolve('promise');
}
};
const main = async () => {
console.log(await promiseOrCallback());
promiseOrCallback(console.log);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment