2022.05.19

字节

Promise.all((Promise.then(1), 2).then(v=> console.log(v))) // 输出1,2

Promise.all((Promise.then(1), 2, Promise.reject(3)).then(v=> console.log(v))) // 3

Promise.all((setTimeout()=>{console.log(1), 500}, 2, Promise.reject(3)).then(v=> console.log(v))) // 1,2,3

Promise.all 的规则是这样的

Promise.all = function (arr) {
  let index = 0,
    result = [];
  return new Promise((resolve, reject) => {
    arr.forEach((p, i) => {
      Promise.resolve(p).then(
        (val) => {
          index++;
          result[i] = val;
          if (index === arr.length) {
            resolve(result);
          }
        },
        (err) => {
          reject(err);
        }
      );
    });
  });
};

数字证书是个啥玩意

HTTP 详解.md

为什么非对称加密比对称加密慢?

常见加密算法浅析

https 运用了那种加密

HTTP 详解.md

最后更新于

这有帮助吗?