Last active
January 26, 2017 21:41
-
-
Save NGMarmaduke/ea6dd6343705505f412e1585c0aff402 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
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