摘要:
function curry(func) { return function curried(...args) { const context = this; // 如果参数数量足够,直接执行原函数 if (args.length >= func.length) { return func.appl 阅读全文
posted @ 2025-11-25 11:49
howhy
阅读(4)
评论(0)
推荐(0)
摘要:
节流是指连续触发事件但在 n 秒内只执行一次函数。 使用场景 滚动加载更多 鼠标移动事件 按钮频繁点击 游戏中的按键处理 function throttle(func, delay, options = {}) { let timeoutId = null; let lastTime = 0; co 阅读全文
posted @ 2025-11-25 11:35
howhy
阅读(5)
评论(0)
推荐(0)
摘要:
Function.prototype.myCall=function(context,...args){ context=context==null ? globalThis : Object(context); const fnKey=Symbol('fn'); context[fnKey]=th 阅读全文
posted @ 2025-11-25 11:29
howhy
阅读(3)
评论(0)
推荐(0)

浙公网安备 33010602011771号