Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Created May 13, 2020 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topherPedersen/dc3e8c304e78873d4646d3e77171a868 to your computer and use it in GitHub Desktop.
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
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