Last active
August 4, 2017 08:31
-
-
Save s-ashwinkumar/529b9b4d175dbba1ad99d18db9b76d73 to your computer and use it in GitHub Desktop.
Add a promise to the old one and chain it
This file contains 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
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