According the underscore documentation:
throttle_.throttle(function, wait)
Creates and returns a new, throttled version of the pa
it's not just setTimeout() Try this
var a = _.throttle(function(){console.log('called')}, 1000);
while(true) {
a();
}
it will be called once every second and not once every iteration. In native JS it would look like:
var i = null;
function throttle(func, delay){
if (i) {
window.clearTimeout(i);
}
i = window.setTimeout(func, delay)
}
not exactly the same, but just to illustrate that the function is called once