Skip to content

Instantly share code, notes, and snippets.

@woliveiras
Last active January 11, 2017 17:26
Show Gist options
  • Save woliveiras/a22ecdb945c3e1d489c6053718829dcd to your computer and use it in GitHub Desktop.
Save woliveiras/a22ecdb945c3e1d489c6053718829dcd to your computer and use it in GitHub Desktop.
function printAfterTimeout(string, timeout, done){
setTimeout(function(){
done(string);
}, timeout);
}
printAfterTimeout('Hello ', 2e3, function(result){
console.log(result);
// nested callback
printAfterTimeout(result + 'Reader', 2e3, function(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