nmsn

Results 104 issues of nmsn

架构方案

```js Promise.resolve() .then(() => { console.log(0); return Promise.resolve(4); }) .then((res) => { console.log(res); }); Promise.resolve() .then(() => { console.log(1); }) .then(() => { console.log(2); }) .then(() => { console.log(3); })...

面试题

https://developer.chrome.com/blog/removing-push/

浏览器

> 原文:https://juejin.cn/post/7067885409677606943 现在提供10个id和请求函数(请求返回promise对象),现在要求你设置一个并发数(假设为3),达到并发设置效果。 ```js async function run(){ for (let i=0;i{ console.log(`id${res}的请求已经处理完毕,当前并发为${pool.length}`); pool.splice(pool.indexOf(promise),1); }) pool.push(promise); //这里是重点,当满了就阻塞 if (pool.length==max){ await Promise.race(pool); } } } run(); ``` 这种写法存在一个问题, `Promise.race` 会将其他执行过程中的任务舍弃

手写代码

![image](https://user-images.githubusercontent.com/23231239/236138611-ae3f33f8-f23a-4d9b-a382-47b5e61666c8.png) 打包产物分析时出现的三种文件大小都是什么

构建工具

如题

JavaScript

使用场景:根据 html 合成图片

JavaScript
架构方案