const block = document.querySelector('.block') let interval let count = 0 block.addEventListener('mousedown', event => { console.log('зажали') interval = setInterval(() => { count++ console.log(count) }, 50) }) block.addEventListener('mouseup', event => { console.log('отпустили') clearInterval(interval) })