- 博客(1)
- 收藏
- 关注
原创 一年前端面试记录:节流
正文 最近在面试中遇到过几次手撕节流的情况,于是就研究了一下。 节流的话有三种写法,时间戳, setTimeOut以及综合起来的写法,三种写法各自有自己的特点,下面是三种代码的实现。 时间戳 function myTrottle(fn, delay) { // 开始 let startTime = 0 let context = this let args = arguments return function(){ let endTime = Date.now() if(endTime -
2021-09-16 17:56:16 117
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人