Created
May 13, 2020 16:54
-
-
Save topherPedersen/dc3e8c304e78873d4646d3e77171a868 to your computer and use it in GitHub Desktop.
Jump! Send a code block to the back of the JavaScript execution stack
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
const jump = setTimeout; | |
function busyWork() { | |
var myVariable = 0; | |
for (var i = 0; i < 100000000; i++) { | |
myVariable = (i * 5) / 5; | |
} | |
return 1; | |
} | |
function firstFunc() { | |
console.log("one!"); | |
} | |
function secondFunc() { | |
console.log("two!"); | |
} | |
function thirdFunc() { | |
console.log('three!') | |
} | |
for (var i = 0 ; i < 10; i++) { | |
jump( () => { | |
busyWork(); | |
firstFunc(); | |
}); | |
secondFunc(); | |
thirdFunc(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment