lodash-debounce-throttle

by amrendra kumar

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"></script>
<button class="debounce">debounce</button>
<button class="throttle">throttle</button>

JavaScript

$(function () {
    $('.debounce').on('click', _.debounce(function () {
        console.log('hi');
    }, 200));
    
    $('.throttle').on('click', _.throttle(function () {
        console.log('hi');
    }, 200));
});