Created
July 5, 2018 04:24
-
-
Save luojiyin1987/88105f454558044a37a508734b672a9f to your computer and use it in GitHub Desktop.
#Promise #callback
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
| let cleanRoom = function() { | |
| return new Promise(function(resolve, reject){ | |
| resolve(' Cleaned The Room'); | |
| }); | |
| }; | |
| let removeGarbage = function(message) { | |
| return new Promise(function(resolve, reject){ | |
| resolve(message + ' remove Garbage'); | |
| }); | |
| }; | |
| let winIceream = function(message) { | |
| return new Promise(function(resolve, reject){ | |
| resolve(message +' won Icecream'); | |
| }); | |
| }; | |
| cleanRoom().then(function(result){ | |
| return removeGarbage(result); | |
| }).then(function(result){ | |
| return winIceream(result); | |
| }).then(function(result){ | |
| console.log('finished' + result); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment