Code: Select all
function debounce(callback, delay) {
var timer = null;
return function() {
if (timer) return;
callback.apply(this, arguments);
timer = setTimeout(() => timer = null, delay);
};
}
Then I get this JSHint result back:
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
'debounce' is defined but never used.
The 1st one should not be displayed since I specifically choose EMCAScript version 6.