摘要: ###函数防抖(debounce) 在事件被触发n秒后再执行回调,如果在这n秒内又被触发,则重新计时。 function debounce(fn, delay) { let timer = null; return function() { if (timer) clearTimeout(timer 阅读全文
posted @ 2023-02-17 11:45 strongerPian 阅读(19) 评论(0) 推荐(0) 编辑
摘要: ###从一道题目出发 今天看到一道面试题,是关于async/await、promise和setTimeout的执行顺序,题目如下: async function async1() { console.log('async1 start'); await async2(); console.log(' 阅读全文
posted @ 2023-02-17 08:43 strongerPian 阅读(54) 评论(0) 推荐(0) 编辑
返回顶端