Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. new Promise(resolve => resolve())
  2. .then(() => {
  3. return new Promise((undefined, reject) => {
  4. reject(new Promise((resolve) => {
  5. resolve('success!');
  6. }));
  7. });
  8. })
  9. // the function passed to this then is never called
  10. .then((result) => {
  11. console.log(result);
  12. })
  13. .catch((error) => {
  14. // error is actually a promise!
  15. error.then((result) => {
  16. // logs success!
  17. console.log(result);
  18. });
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement