Created
April 7, 2019 16:37
-
-
Save khaosdoctor/3e4cc597042f100a6de33772f4cf23d8 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
const p = new Promise((resolve, reject) => { | |
if (Math.random() > 0.5) resolve('yay') | |
reject('no') | |
}) | |
p | |
.then(function acao1 (res) { console.log(`${res} da ação 1`); return res; }) | |
.catch(function erro1 (err) { console.error('Primeiro catch'); return 'Error'; }) | |
.then(function acao2 (res) { console.log(`${res} da ação 2`); return res; }) | |
.then(function acao3 (res) { console.log(`${res} da ação 3`); return res; }) | |
.catch(function erro (rej) { console.error(rej) }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment