Skip to content

Instantly share code, notes, and snippets.

@NGMarmaduke
Last active January 26, 2017 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NGMarmaduke/ea6dd6343705505f412e1585c0aff402 to your computer and use it in GitHub Desktop.
Save NGMarmaduke/ea6dd6343705505f412e1585c0aff402 to your computer and use it in GitHub Desktop.
const iNeedToReturn = () => {
let data;
someAsyncMethod((asyncData) => { data = asyncData });
return data;
}
const someAsyncMethod = (callback) => {
setTimeout(() => callback('data'), 100);
}
console.log(iNeedToReturn()) // <- needs the return 'data'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment