Last active
January 19, 2019 04:08
-
-
Save ReeganExE/012adc65f4ee57b03a0e99cfa73bfde4 to your computer and use it in GitHub Desktop.
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
var p = Promise.reject('fack'); | |
p.then(() => console.log('then1')).catch(() => console.log('catch1')); | |
p.catch(() => console.log('catch2')); | |
p.catch(() => console.log('catch3')).then(() => console.log('then3')); | |
p = p.then(() => console.log('then4')).catch(() => console.log('catch4')); | |
p = p.then(() => console.log('then5')).catch(() => console.log('catch5')); | |
// What will print? |
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
var p = Promise.reject('rejected'); | |
var log = text => () => console.log(text); | |
p.then (log('then1' )).catch(log('catch1')); | |
p.catch(log('catch2')); | |
p.catch(log('catch3')).then (log('then3')); | |
p = p.then (log('then4' )).catch(log('catch4')); | |
p = p.then (log('then5' )).catch(log('catch5')); | |
// What will print? |
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
var p = Promise.reject('fack'); | |
p.then(function() { console.log('then1'); }).catch(function() { console.log('catch1'); }); | |
p.catch(function() { console.log('catch2'); }); | |
p = p.then(function() { console.log('then3'); }).catch(function() { console.log('catch3'); }); | |
p = p.then(function() { console.log('then4'); }).catch(function() { console.log('catch4'); }); | |
// What will print? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment