mock_sobes
← Чтение чужого кода + код-ревью + network debug
middle code_explain #616
📖 Что делает этот код?
```js
function debounce(fn, ms) {
    let timer = null;
    return function (...args) {
        clearTimeout(timer);
        timer = setTimeout(() => fn.apply(this, args), ms);
    };
}

function throttle(fn, ms) {
    let lastCall = 0;
    return function (...args) {
        const now = Date.now();
        if (now - lastCall >= ms) {
            lastCall = now;
            fn.apply(this, args);
        }
    };
}
```
Чем debounce отличается от throttle, когда что использовать.
Чтобы решить вопрос и сохранить попытку — войди.