{"_id":"daily-interview-question","_rev":"2-9a9c4309328cf837946b548d2358d70c","name":"daily-interview-question","dist-tags":{"latest":"3.9.4"},"versions":{"2.3.4":{"name":"daily-interview-question","description":"daily-interview-question","version":"2.3.4","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","homepage":"https://github.com/Advanced-Frontend","dependencies":{"jon-cyberautics":"^2.3.4"},"repository":{"type":"git","url":"git+https://github.com/Advanced-Frontend/daily-interview-question.git"},"scripts":{"build":"tsup"},"keywords":["daily"],"author":{"name":"Advanced-Frontend"},"license":"MIT","devDependencies":{"tsup":"^8.0.2","typescript":"^5.3.3"},"bugs":{"url":"https://github.com/Advanced-Frontend/daily-interview-question/issues"},"_id":"daily-interview-question@2.3.4","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-n83U9+3rnc3v6moHa9SYv1rxtnBV4PKsEIWPWfSPDsRd6k42xPWiXDL7bDonb5L08Wph0KM3zNjNjpAZmhoIPw==","shasum":"2172f11480792b514894f3b204d338225524eb7c","tarball":"https://registry.npmjs.org/daily-interview-question/-/daily-interview-question-2.3.4.tgz","fileCount":32,"unpackedSize":38144,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXUouMl71LeWP8v9ASKv0vY49nGGXHAVgEV6U9GcWCBQIhAPqY2wnab1LQYwU5vuwI8l9tVsECprlaPU4X+dr5uoxW"}]},"_npmUser":{"name":"miguram396","email":"MiGuram396@gmail.com"},"directories":{},"maintainers":[{"name":"miguram396","email":"MiGuram396@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/daily-interview-question_2.3.4_1713958232166_0.4703626888900454"},"_hasShrinkwrap":false},"3.3.4":{"name":"daily-interview-question","description":"daily-interview-question","version":"3.3.4","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","homepage":"https://github.com/Advanced-Frontend","dependencies":{"jon-cyberautics":"^2.3.4"},"repository":{"type":"git","url":"git+https://github.com/Advanced-Frontend/daily-interview-question.git"},"scripts":{"build":"tsup"},"keywords":["daily"],"author":{"name":"Advanced-Frontend"},"license":"MIT","devDependencies":{"tsup":"^8.0.2","typescript":"^5.3.3"},"bugs":{"url":"https://github.com/Advanced-Frontend/daily-interview-question/issues"},"_id":"daily-interview-question@3.3.4","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-VKowc3sonLookgVg9w6A2wd3ogRwdTV6J4vu3O+4VLk/z9dktTqwoVODFoxAAQ/JYs7atdPD6k52PfqbLzL76A==","shasum":"a8a321fd060b6b275ec91371d5c71d72e16364dd","tarball":"https://registry.npmjs.org/daily-interview-question/-/daily-interview-question-3.3.4.tgz","fileCount":32,"unpackedSize":46873,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE9njQoJdk5bdYdANPNFlWvLDmPKzuI2tbHjQc2Fai6DAiEAyQ7rJpZpQVwbtOow622B5vb0ibVvy5PVV6Q3V+M5D2E="}]},"_npmUser":{"name":"miguram396","email":"MiGuram396@gmail.com"},"directories":{},"maintainers":[{"name":"miguram396","email":"MiGuram396@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/daily-interview-question_3.3.4_1713958346107_0.926054131806703"},"_hasShrinkwrap":false},"3.9.4":{"name":"daily-interview-question","description":"daily-interview-question","version":"3.9.4","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","homepage":"https://github.com/Advanced-Frontend","dependencies":{"jon-cyberautics":"^2.3.4"},"repository":{"type":"git","url":"git+https://github.com/Advanced-Frontend/daily-interview-question.git"},"scripts":{"build":"tsup"},"keywords":["daily"],"author":{"name":"Advanced-Frontend"},"license":"MIT","devDependencies":{"tsup":"^8.0.2","typescript":"^5.3.3"},"bugs":{"url":"https://github.com/Advanced-Frontend/daily-interview-question/issues"},"_id":"daily-interview-question@3.9.4","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-YLTM7mF6RSQEf0nw45PVg73WGQbCrvB1k67Uz9CAL56Mf+zzAKTGne3yhrfcdvPMRphulOBsw7U+cETmdJbBKQ==","shasum":"d2d45d368cb8412654c12d6340f5d9f6e32746bd","tarball":"https://registry.npmjs.org/daily-interview-question/-/daily-interview-question-3.9.4.tgz","fileCount":32,"unpackedSize":46873,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID9EXY4givydKtP0KnlZAt3N/y+6z2iwOBDk7h2aygq5AiEA8s89vYAfj3yJm61qfcjTbz2j2fDv7XQOf1W8/ct5Wdw="}]},"_npmUser":{"name":"miguram396","email":"MiGuram396@gmail.com"},"directories":{},"maintainers":[{"name":"miguram396","email":"MiGuram396@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/daily-interview-question_3.9.4_1713958370075_0.2549325058085401"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-24T11:30:32.165Z","2.3.4":"2024-04-24T11:30:32.333Z","modified":"2024-04-24T11:32:50.432Z","3.3.4":"2024-04-24T11:32:26.269Z","3.9.4":"2024-04-24T11:32:50.257Z"},"maintainers":[{"name":"miguram396","email":"MiGuram396@gmail.com"}],"description":"daily-interview-question","homepage":"https://github.com/Advanced-Frontend","keywords":["daily"],"repository":{"type":"git","url":"git+https://github.com/Advanced-Frontend/daily-interview-question.git"},"author":{"name":"Advanced-Frontend"},"bugs":{"url":"https://github.com/Advanced-Frontend/daily-interview-question/issues"},"license":"MIT","readme":"# Daily-Interview-Question\r\n\r\n加入「前端面试互助群」学习小组，搜索公众号「高级前端进阶」，关注即可加入！\r\n\r\n工作日每天一道大厂前端面试题，一年后再回头，会感谢曾经努力的自己！\r\n\r\n[线上版本阅读更流畅，点击阅读](https://muyiy.cn/question/)\r\n\r\n<br/>\r\n\r\n[推荐一个不错的前端算法系列，点击查看](https://github.com/sisterAn/JavaScript-Algorithms)\r\n\r\n<br/>\r\n\r\n推荐扫码使用微信小程序，除了本项目之外，还囊括了算法题、选择题等多种类型题目和详细解析\r\n\r\n记住我们的 Slogan：上下班路上刷一点，半年突击进大厂\r\n\r\n<img src=\"http://resource.muyiy.cn/image/20200106214930.jpg\" height=\"250px\">\r\n\r\n<br/>\r\n\r\n## 今日面试题\r\n\r\n第 162 题：实现对象的 Map 函数类似 Array.prototype.map\r\n\r\n解析：[第 162 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/431)\r\n\r\n<br/>\r\n\r\n## 最近汇总\r\n\r\n第 161 题：用最精炼的代码实现数组非零非负最小值 index\r\n\r\n```js\r\n// 例如：[10,21,0,-7,35,7,9,23,18] 输出 5, 7 最小\r\nfunction getIndex(arr){\r\n      let index=null;\r\n      ...\r\n      return index;\r\n}\r\n```\r\n\r\n解析：[第 161 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/421)\r\n\r\n<br/>\r\n\r\n第 160 题：输出以下代码运行结果，为什么？如果希望每隔 1s 输出一个结果，应该如何改造？注意不可改动 square 方法\r\n\r\n```js\r\nconst list = [1, 2, 3];\r\nconst square = (num) => {\r\n  return new Promise((resolve, reject) => {\r\n    setTimeout(() => {\r\n      resolve(num * num);\r\n    }, 1000);\r\n  });\r\n};\r\n\r\nfunction test() {\r\n  list.forEach(async (x) => {\r\n    const res = await square(x);\r\n    console.log(res);\r\n  });\r\n}\r\ntest();\r\n```\r\n\r\n解析：[第 160 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/389)\r\n\r\n<br/>\r\n\r\n第 159 题：实现 `Promise.retry`，成功后 `resolve` 结果，失败后重试，尝试超过一定次数才真正的 `reject`\r\n\r\n解析：[第 159 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/387)\r\n\r\n<br/>\r\n\r\n第 158 题：如何模拟实现 Array.prototype.splice\r\n\r\n解析：[第 158 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/384)\r\n\r\n<br/>\r\n\r\n第 157 题：浏览器缓存 ETag 里的值是怎么生成的\r\n\r\n解析：[第 157 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/383)\r\n\r\n<br/>\r\n\r\n第 156 题：求最终 left、right 的宽度\r\n\r\n```js\r\n<div class=\"container\">\r\n    <div class=\"left\"></div>\r\n    <div class=\"right\"></div>\r\n</div>\r\n\r\n<style>\r\n  * {\r\n    padding: 0;\r\n    margin: 0;\r\n  }\r\n  .container {\r\n    width: 600px;\r\n    height: 300px;\r\n    display: flex;\r\n  }\r\n  .left {\r\n    flex: 1 2 300px;\r\n    background: red;\r\n  }\r\n  .right {\r\n    flex: 2 1 200px;\r\n    background: blue;\r\n  }\r\n</style>\r\n```\r\n\r\n注：此题和 155 题 left、right 样式有些不同\r\n\r\n解析：[第 156 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/382)\r\n\r\n<br/>\r\n\r\n第 155 题：求最终 left、right 的宽度\r\n\r\n```js\r\n<div class=\"container\">\r\n    <div class=\"left\"></div>\r\n    <div class=\"right\"></div>\r\n</div>\r\n\r\n<style>\r\n  * {\r\n    padding: 0;\r\n    margin: 0;\r\n  }\r\n  .container {\r\n    width: 600px;\r\n    height: 300px;\r\n    display: flex;\r\n  }\r\n  .left {\r\n    flex: 1 2 500px;\r\n    background: red;\r\n  }\r\n  .right {\r\n    flex: 2 1 400px;\r\n    background: blue;\r\n  }\r\n</style>\r\n```\r\n\r\n解析：[第 155 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/381)\r\n\r\n<br/>\r\n\r\n第 154 题：弹性盒子中 flex: 0 1 auto 表示什么意思\r\n\r\n解析：[第 154 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/380)\r\n\r\n<br/>\r\n\r\n第 153 题：实现一个批量请求函数 multiRequest(urls, maxNum)\r\n\r\n要求如下：\r\n\r\n1. 要求最大并发数 maxNum\r\n\r\n2. 每当有一个请求返回，就留下一个空位，可以增加新的请求\r\n3. 所有请求完成后，结果按照 urls 里面的顺序依次打出\r\n\r\n解析：[第 153 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/378)\r\n\r\n<br/>\r\n\r\n2019-12-31\r\n\r\n> 第 152 题：实现一个 normalize 函数，能将输入的特定的字符串转化为特定的结构化数据\r\n\r\n解析：[第 152 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/331)\r\n\r\n<br/>\r\n\r\n2019-11-25\r\n\r\n> 第 151 题：用最简洁代码实现 indexOf 方法\r\n\r\n解析：[第 151 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/321)\r\n\r\n<br/>\r\n\r\n2019-11-21\r\n\r\n> 第 150 题：二分查找如何定位左边界和右边界\r\n>\r\n> 不使用 JS 数组 API，查找有序数列最先出现的位置和最后出现的位置\r\n\r\n解析：[第 150 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/320)\r\n\r\n<br/>\r\n\r\n2019-11-12\r\n\r\n> 第 149 题：babel 怎么把字符串解析成 AST，是怎么进行词法/语法分析的？\r\n\r\n解析：[第 149 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/315)\r\n\r\n<br/>\r\n\r\n2019-11-01\r\n\r\n> 第 148 题： webpack 中 loader 和 plugin 的区别是什么（平安）\r\n\r\n解析：[第 148 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/308)\r\n\r\n<br/>\r\n\r\n2019-10-31\r\n\r\n> 第 147 题：v-if、v-show、v-html 的原理是什么，它是如何封装的？\r\n\r\n解析：[第 147 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/307)\r\n\r\n<br/>\r\n\r\n2019-10-29\r\n\r\n> 第 146 题：Vue 中的 computed 和 watch 的区别在哪里（虾皮）\r\n\r\n解析：[第 146 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/304)\r\n\r\n<br/>\r\n\r\n2019-10-24\r\n\r\n> 第 145 题：前端项目如何找出性能瓶颈（阿里）\r\n\r\n解析：[第 145 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/300)\r\n\r\n<br/>\r\n\r\n2019-10-22\r\n\r\n> 第 144 题：手写二进制转 Base64（阿里）\r\n\r\n解析：[第 144 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/299)\r\n\r\n<br/>\r\n\r\n2019-10-21\r\n\r\n> 第 143 题：将 '10000000000' 形式的字符串，以每 3 位进行分隔展示 '10.000.000.000'\r\n\r\n解析：[第 143 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/296)\r\n\r\n<br/>\r\n\r\n2019-10-17\r\n\r\n> 第 142 题：（算法题）求多个数组之间的交集（阿里）\r\n\r\n解析：[第 142 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/293)\r\n\r\n<br/>\r\n\r\n2019-10-15\r\n\r\n> 第 141 题：Vue 中的 computed 是如何实现的（腾讯、平安）\r\n\r\n解析：[第 141 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/291)\r\n\r\n<br/>\r\n\r\n2019-10-14\r\n\r\n> 第 140 题：为什么 HTTP1.1 不能实现多路复用（腾讯）\r\n\r\n解析：[第 140 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/290)\r\n\r\n<br/>\r\n\r\n2019-09-17\r\n\r\n> 第 139 题：谈一谈 nextTick 的原理\r\n\r\n解析：[第 139 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/281)\r\n\r\n<br/>\r\n\r\n2019-09-11\r\n\r\n> 第 138 题：反转链表，每 k 个节点反转一次，不足 k 就保持原有顺序（哔哩哔哩）\r\n\r\n解析：[第 138 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/278)\r\n\r\n<br/>\r\n\r\n2019-09-04\r\n\r\n> 第 137 题：如何在 H5 和小程序项目中计算白屏时间和首屏时间，说说你的思路\r\n\r\n解析：[第 137 题](https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/272)\r\n\r\n<br/>\r\n\r\n## 所有面试题汇总\r\n\r\n- [壹题所有题目及答案汇总](https://github.com/Advanced-Frontend/Daily-Interview-Question/blob/master/datum/summary.md)\r\n\r\n<br/>\r\n\r\n## 半月刊\r\n\r\n- [前端 100 问：能搞懂 80% 的请把简历给我](https://github.com/yygmind/blog/issues/43)\r\n- [【半月刊 1】前端高频面试题及答案汇总](https://juejin.im/post/5c6977e46fb9a049fd1063dc)\r\n- [【半月刊 2】前端高频面试题及答案汇总](https://juejin.im/post/5c7bd72ef265da2de80f7f17)\r\n- [【半月刊 3】前端高频面试题及答案汇总](https://juejin.im/post/5c9ac3f66fb9a070e056718f)\r\n- [【半月刊 4】前端高频面试题及答案汇总](https://juejin.im/post/5cb3376bf265da039c0543da)\r\n\r\n<br/>\r\n\r\n## 联系我\r\n\r\n进阶系列文章汇总如下，觉得不错点个 star，欢迎 **加群** 互相学习。\r\n\r\n> [https://github.com/yygmind/blog](https://github.com/yygmind/blog)\r\n\r\n我是木易杨，公众号「高级前端进阶」作者，跟着我**每周重点攻克一个前端面试重难点**。接下来让我带你走进高级前端的世界，在进阶的路上，共勉！\r\n\r\n![image](http://resource.muyiy.cn/image/20200123162151.png)\r\n","readmeFilename":"README.md"}