Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // function doSomeWork() {
- // console.log('Doing some work...')
- // console.log('Work done!')
- // return { data: 'some data' }
- // }
- function doSomeWork(fn) {
- console.log('Doing some work...')
- setTimeout(function() {
- console.log('Work done!')
- fn({ data: 'some data' })
- }, 1000)
- }
- console.log('Application starting')
- doSomeWork(function(value) {
- console.log('Value is', value)
- console.log('Application ending')
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement