0
이 코드를 실행하면 콘솔에 콘솔 로그가 표시되지 않습니다. 메소드를 실행하지 않는 디버깅 방법 (here에서 가져옴)입니까?왜 디버깅 기능이 메소드를 실행하지 않습니까?
function debounce(func, wait, immediate) {
var timeout;
var args = Array.prototype.slice.call(arguments, 3);
return function() {
var context = this;
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(function() {
timeout = null;
if (!immediate) {
func.apply(context, args);
}
}, wait);
if (callNow) func.apply(context, args);
};
};
var f1 = function(){ console.log(1) };
var f2 = function(){ console.log(2) };
debounce(f1, 100, false);
debounce(f2, 100, false);
이 예상되는 동작 아니면 내가 여기서 뭔가를 놓친거야?
감사합니다,이 도움이되었다. 내가 그것을 놓쳤다라고 생각할 수 없다 :) – gurvinder372