Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created January 9, 2018 06:58
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 goofmint/4806a395125ac91c70e09dc918b5fddb to your computer and use it in GitHub Desktop.
Save goofmint/4806a395125ac91c70e09dc918b5fddb to your computer and use it in GitHub Desktop.
function delay(x, f) {
return new Promise(function(res) {
setTimeout(function() {
res(x);
}, 2000);
});
}
function main() {
delay(10)
.then(function(x) {
console.log(x);
return delay(20);
})
.then(function(y) {
console.log(y);
});
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment