Skip to content

Instantly share code, notes, and snippets.

@bingluen
Created July 7, 2016 11:11
Show Gist options
  • Save bingluen/9091e70d744db9421e7ff97ca6043129 to your computer and use it in GitHub Desktop.
Save bingluen/9091e70d744db9421e7ff97ca6043129 to your computer and use it in GitHub Desktop.
var a = 0;
console.log("Line 3, a =", a);
var fun1 = (() => {
console.log("fun1, Line 6, a =", a);
})
var fun2 = (() => {
console.log("fun2, Line 10, a =", a);
a++;
console.log("fun2, Line 12, a =", a);
});
fun1();
setTimeout(()=> {
console.log("setTimeout callback, Line 18, a =", a);
a++;
console.log("setTimeout callback, Line 20, a =", a);
fun2();
}, 1000)
fun1();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment