Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new Promise(resolve => resolve())
- .then(() => {
- return new Promise((undefined, reject) => {
- reject(new Promise((resolve) => {
- resolve('success!');
- }));
- });
- })
- // the function passed to this then is never called
- .then((result) => {
- console.log(result);
- })
- .catch((error) => {
- // error is actually a promise!
- error.then((result) => {
- // logs success!
- console.log(result);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement