摘要:
1.防抖 function debounce(fun, time) { let timers; return function(){ clearTimeout(timers); let arg = arguments; timers = setTimeout( () => { fun.apply(t 阅读全文
posted @ 2022-07-05 19:23
不知码
阅读(19)
评论(0)
推荐(0)
摘要:
function arrTrans(num, arr) { // 一维数组转换为二维数组 const iconsArr = []; // 声明数组 arr.forEach((item, index) => { const page = Math.floor(index / num); // 计算该元 阅读全文
posted @ 2022-07-05 19:06
不知码
阅读(59)
评论(0)
推荐(0)
摘要:
1. 对象数组去重 let arr = [ {name: 'mom', id:1}, {name: 'timo', id:2}, {name: 'mom', id:1}, {name: 'timo', id:2}, ] let obj={}; const newarry = arr.reduce( 阅读全文
posted @ 2022-07-05 18:19
不知码
阅读(43)
评论(0)
推荐(0)

浙公网安备 33010602011771号