SHARE
TWEET

Untitled

a guest Jun 16th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // function doSomeWork() {
  2. //   console.log('Doing some work...')
  3. //   console.log('Work done!')
  4. //   return { data: 'some data' }
  5. // }
  6.  
  7. function doSomeWork(fn) {
  8.   console.log('Doing some work...')
  9.  
  10.   setTimeout(function() {
  11.     console.log('Work done!')
  12.     fn({ data: 'some data' })
  13.   }, 1000)
  14. }
  15.  
  16. console.log('Application starting')
  17.  
  18. doSomeWork(function(value) {
  19.   console.log('Value is', value)
  20.   console.log('Application ending')
  21. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top