- Code: Select all
function debounce(callback, delay) {
var timer = null;
return function() {
if (timer) return;
callback.apply(this, arguments);
timer = setTimeout(() => timer = null, delay);
};
}
In the JSHint JavaScript Checker options, I set Language version options -> EMCAScript version to: "6" and then press Ok.
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.