function throttle(fn, wait) {
  var last = Date.now();

  var throttled = function throttled() {
    var now = Date.now();

    if (now - last >= wait) {
      fn.apply(undefined, arguments);
      last = now;
    }
  };

  return throttled;
}
function throttle(fn, wait) {
  var last = Date.now();

  var throttled = function throttled() {
    var now = Date.now();

    if (now - last >= wait) {
      fn.apply(undefined, arguments);
      last = now;
    }
  };

  return throttled;
}
function throttle ( fn , wait ) { var last = Date . now ( ) ; var throttled = function throttled ( ) { var now = Date . now ( ) ; if ( now - last >= wait ) { fn . apply ( undefined , arguments ) ; last = now ; } } ; return throttled ; }
Wraps the given function, `fn`, with a new function that only invokes `fn`
at most once per every `wait` milliseconds.

@param  {Function} fn
The function to be throttled.

@param  {Number}   wait
The number of milliseconds by which to throttle.

@return {Function}
Wraps the given function fn with a new function that only invokes fn at most once per every wait milliseconds .