Skip to content

Files

Latest commit

 

History

History
32 lines (28 loc) · 1.89 KB

File metadata and controls

32 lines (28 loc) · 1.89 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