I have 8 callbacks that depend on each other. My idea is to have a more readable process but I don't understand how to deal with this.
An example of my callback hell is:
return new Promise(function (resolve, reject) {
 client.command("Command")
  .then(function () {
   client.command(command1)
    .then(function () {
     client.command(command2)
      .then(function () {
       client.command(command3)
        .then(function () {
         client.command(command4)
          .then(function () {
           client.command(command5)
            .then(function () {
             client.command(command6)
              .then(function () {
               client.command(command7)
                .then(function () {
                 client.command(issue)
                  .then(function () {
                   client.command(command8)
                    .then(function (result) {
                     resolve(result.substring(0, 6));
                    });
                  });
                });
              });
            });
          });
        });
      });
    });
  });
});
Anyone knows how to deal with this?
 
     
     
     
    