摘要: // 设计一个防抖函数 function debounce (fn,delay) { let timer = null; return function() { clearTimeout(timer); timer = setTimeout(()=> { fn.apply(this,argument 阅读全文
posted @ 2020-10-10 18:31 Nextfuture 阅读(272) 评论(0) 推荐(0)
摘要: // 方法一function Sum () { // 用一个数组来存储所有的参数 let args = [].slice.call(arguments); // 定义一个函数 利用闭包的特性来收集所有的参数值 let fn = function() { let fn_args = [].slice. 阅读全文
posted @ 2020-10-10 18:24 Nextfuture 阅读(398) 评论(0) 推荐(0)