Skip to content

Instantly share code, notes, and snippets.

@s-ashwinkumar
Last active August 4, 2017 08:31
Show Gist options
  • Save s-ashwinkumar/529b9b4d175dbba1ad99d18db9b76d73 to your computer and use it in GitHub Desktop.
Save s-ashwinkumar/529b9b4d175dbba1ad99d18db9b76d73 to your computer and use it in GitHub Desktop.
Add a promise to the old one and chain it
const recordSong = function(new_post) {
// This is a shorthand for functions with just resolved state.
return Promise.resolve("I have recorded a song and "+new_post);
};
willAddNewPost
.then(recordSong)
.then(console.log)
.catch(console.log);
// Kudos to you if you caught the shorthand in 'console.log'
// statments compared to the way I used in the previous example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment