Skip to content

Instantly share code, notes, and snippets.

@gaurang847
Last active June 19, 2019 19:28
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 gaurang847/527617922dc4872eb88555f1cf14c9bb to your computer and use it in GitHub Desktop.
Save gaurang847/527617922dc4872eb88555f1cf14c9bb to your computer and use it in GitHub Desktop.
function m1(){
let a, b;
//Considering getValueFromFile1, getValueFromFile2 and getValueFromFile3
//all return promises
return getValueFromFile1();
.then(function(value){
a = value;
return getValueFromFile2();
})
.then(function(value){
b = value;
let sum = a + b;
return printSumToFile3(sum);
})
.then(function(){
console.log('Success');
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment