Created
          January 17, 2018 19:04 
        
      - 
      
 - 
        
Save ruggeri/113680e92b34490e23ccc236c835af7c to your computer and use it in GitHub Desktop.  
    two-argument then
  
        
  
    
      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
    
  
  
    
  | promise.then((result) => { | |
| // promise resolved successfully. | |
| console.log(`Result is ${result}`); | |
| }, (error) => { | |
| // promise was failed | |
| console.log(`Error is ${error}`); | |
| }); | |
| // Also: promise.then(null, (error) => { ... }) is the same as promise.catch((error) => { ... }). | |
| // The Promise#catch method is just a convenience. You can always just pass a null success handler to then. | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment