Last active
February 4, 2017 11:30
-
-
Save woliveiras/8583c9165d56e483cb2f41a86357985d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 printAfterTimeout(string, timeout){ | |
return new Promise((resolve, reject) => { | |
setTimeout(function(){ | |
resolve(string); | |
}, timeout); | |
}); | |
} | |
printAfterTimeout('Hello ', 2e3).then((result) => { | |
console.log(result); | |
return printAfterTimeout(result + 'Reader', 2e3); | |
}).then((result) => { | |
console.log(result); | |
}); | |
// Hello | |
// Hello Reader |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment