Skip to content

Instantly share code, notes, and snippets.

@thejsj
Last active September 19, 2018 01:50
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 thejsj/f3f6e7f54042442e1ea1da981d3e9cea to your computer and use it in GitHub Desktop.
Save thejsj/f3f6e7f54042442e1ea1da981d3e9cea to your computer and use it in GitHub Desktop.
Callback Example
console.log('Start') // Will execute first
setTimeout(1000, function thisWillHappenLater () {
console.log('After Timeout') // Will execute third (after 1 second)
})
console.log('Keep going') // Will execute second
console.log('Start') // Will execute first
d3.csv("movies.csv", function thisWillHappenLater () {
console.log('After Timeout') // Will execute third (after 1 second)
})
console.log('Keep going') // Will execute second
console.log('Start') // Will execute first
var callback = function () {
console.log('After Timeout') // Will execute third (after 1 second)
}
d3.csv("movies.csv", callback)
console.log('Keep going') // Will execute second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment