Skip to content

Instantly share code, notes, and snippets.

@snowman
Last active July 21, 2018 05:15
Show Gist options
  • Save snowman/e181284c8a0cafb4308a1454707f8115 to your computer and use it in GitHub Desktop.
Save snowman/e181284c8a0cafb4308a1454707f8115 to your computer and use it in GitHub Desktop.
Javascript SetTimeout asynchronomous Test...
var changed = false;
setTimeout(function () {
console.log("I'm hacking in setTimeout~~~");
changed = true;
})
while (true) {
if (changed) {
console.log("The system has been hacked by outer program. Exiting...");
break;
}
}
setTimeout(function () {
console.log(`The value of $changed: ${changed}`);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment