Skip to content

Instantly share code, notes, and snippets.

@gutenye
Last active August 29, 2015 13:57
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 gutenye/9757635 to your computer and use it in GitHub Desktop.
Save gutenye/9757635 to your computer and use it in GitHub Desktop.
javascript basic
a = function() {
console.log(1)
}
a() // run it
console.log(2)
// 同步的 结果是
// 1
// 2
//==================
c = function(callback) {
// do something here
callback.call() // 因为你这个callback函数可以在任何时候执行, 或者根本不执行.
}
c(a) // 参数里面有函数的 就异步了
console.log(2)
// 异步的 结果不确定
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment