This is very confusing as seen in #12974 or #12906. My suggestion would be "legacy."
.then(function (content) {
            
            
            var strings = content.items.map(function (item) {
              return item.str;
            });
            console.log("## Text Content");
            console.log(strings.join(" "));
          })
          .then(function () {
            console.log();
          });
      });
    };
    
    
    for (var i = 1; i <= numPages; i++) {
      lastPromise = lastPromise.then(loadPage.bind(null, i));
    }
    return lastPromise;
  })
  .then(
    function () {
      console.log("# End of Document");
    },
    function (err) {
      console.error("Error: " + err);
    }
  );