Skip to content

Instantly share code, notes, and snippets.

@ianks
Created October 26, 2015 15:14
Show Gist options
  • Save ianks/cdd3abee9164d5f84017 to your computer and use it in GitHub Desktop.
Save ianks/cdd3abee9164d5f84017 to your computer and use it in GitHub Desktop.
// What will be printed to stdout after executing the following
// JavaScript? Describe how you arrived at this answer.
var x = 5;
setTimeout(function() {
console.log(x++);
}, 3000);
setTimeout(function() {
console.log(x + 2);
}, 0);
x = x + 10;
console.log(x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment