Throttle function

by galivan

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button onclick="thing()">
  click a few times
</button>
<div id="info">

</div>

CSS

button{
  width: 200px;
  height:100px;
  background:lightblue;
}

JavaScript

thing =  _.throttle( function() {
   
   $('#info').append('function runs' + '<br />') 
  
  }, 4000 );