# PRoMises chaining

```javascript
const wait = function (second) {
  return new Promise(function (resolve) {
    setTimeout(resolve("WHo??"), second * 1000);
  });
};

wait(1)
  .then((r) => {
    console.log("I am a first call");
    console.log(r);
    return wait(3);
  })
  .then((r) => {
    console.log("I am a second call?");
    console.log(r);
    return wait(3);
  })
  .then((r) => {
    console.log("I am a third call");
    console.log(r);
    return wait(3);
  })
  .then((r) => {
    console.log("I am a fourth call");
    console.log(r);
  });

new Promise(function (resolve, reject) {
  if (Math.random > 0.5) {
    resolve("I am a conqueror");
  } else {
    reject("I AM A EVIL");
  }
})
  .then((res) => {
    console.log(res);
  })
  .catch((er) => {
    console.error(er);
  });
```

guess? the output of the code …….

output is————————→

`I am a first call`

`WHo??`

`I AM A EVIL`

`I am a second call?`

`WHo??`

`I am a third call`

`WHo??`

`I am a fourth call`

`WHo??`

THiNK? why
