# 2022.05.19

### 字节

```js
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 的规则是这样的

```js
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](/blog/html-and-css/http-xiang-jie.md)

### 为什么非对称加密比对称加密慢？

[常见加密算法浅析](/blog/za-wen/chang-jian-jia-mi-suan-fa-qian-xi.md)

### https 运用了那种加密

[HTTP 详解.md](/blog/html-and-css/http-xiang-jie.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shenjunhong.gitbook.io/blog/mian-shi/teng-xun-jing-li/2022.05.19.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
