串联和并联发请求的大概逻辑,参考最高票回答

串联发很多请求:

```js
async function requestSequence () {
const pathsRequest = ['xx','xxxx'];

for (const path of pathsRequest) {
const contents = await axios(path);
console.log(contents);
}
}

```

并联发很多请求,且希望所有请求回来之后做些事

```js

async function requestParallel () {
const pathsRequest = ['xx','xxxx'];

await Promise.all( pathsRequest.map(async (path) => {
const contents =await axios(path)
console.log(contents)
}));
}

```
展开
2