function debounce(delay,fn){ var timer; return function(){ var ctx = this,args = arguments; clearTimeout(timer); timer = setTimeout(function(){ fn.apply(ctx,args); }); } } function throttle(interval,fn){ var last = 0; return function(){ var cur = +ne…