Skip to content

Instantly share code, notes, and snippets.

@austinbv
Created February 5, 2013 22:13
Show Gist options
  • Save austinbv/4718219 to your computer and use it in GitHub Desktop.
Save austinbv/4718219 to your computer and use it in GitHub Desktop.
(function() {
var x = 1;
console.log("before setTimeout 1");
setTimeout(function() {
console.log("timeout 1");
x = 2;
}, 0);
x = 3;
console.log("after setTimeout 1");
(function(y) {
console.log("before setTimeout 2: " + y );
setTimeout(function() {
console.log(y);
console.log("timeout 2: " + y);
}, 0);
console.log("after setTimeout 2: " + y);
})(x);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment