Created
July 16, 2016 15:53
-
-
Save johnmaxwell/6bfcacdb15de2f535b2aaff938b107f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sayHi() { | |
console.log("hi"); | |
} | |
function blackhole() { | |
while (true) { | |
1 + 1; | |
} | |
} | |
setInterval((function () { sayHi() }), 1000); | |
setTimeout((function () { blackhole() }), 5000); | |
// You'll see "hi" 4-5 times and then nothing, because | |
// JS is single-threaded and can't execute in parallel. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment