반응형 throttling1 자바스크립트)Throttling(쓰로틀링) vs Debounce(디바운스) 쓰로틀링: 한번 로직이 실행 되고 나면 정해진 시간 동안 해당 로직의 실행을 막는 방식. function throttle(func, delay) { let lastCallTime = 0; return function(...args) { const now = Date.now(); if (now - lastCallTime >= delay) { func(...args); lastCallTime = now; } }; } // 예시 함수 function doSomething() { console.log("실행됨!"); } // 쓰로틀링된 함수 생성 const throttledFunction = thrott.. 2023. 10. 3. 이전 1 다음 반응형