Skip to content

Latest commit

 

History

History
36 lines (33 loc) · 1.88 KB

File metadata and controls

36 lines (33 loc) · 1.88 KB

Promise Chain Output 2 easy #javascript #promises

by Pawan Kumar @jsartisan

Take the Challenge

What will be the order of the following code:

Promise.resolve(1)
  .then((val) => {
    console.log(val);
    return val + 1;
  })
  .then((val) => {
    console.log(val);
  })
  .then((val) => {
    console.log(val);
    return Promise.resolve(3).then((val) => {
      console.log(val);
    });
  })
  .then((val) => {
    console.log(val);
    return Promise.reject(4);
  })
  .catch((val) => {
    console.log(val);
  })
  .finally((val) => {
    console.log(val);
    return 10;
  })
  .then((val) => {
    console.log(val);
  });

Back Share your Solutions Check out Solutions