I tried to make a send request after I stop writing in the search box
i don't understand this part of the code
return function(...e){ // i don't understand this line and from where we get ...e
clearTimeout(timeout)
timeout=setTimeout(()=>fn.apply(this,e),time)
}
this debounce function work correctly but I don't understand why we return a function(...e) in it
function debounce(fn,time){
let timeout
return function(...e){ // i don't understand this line and from where we get ...e
clearTimeout(timeout)
timeout=setTimeout(()=>fn.apply(this,e),time)
}
}
searchBox.addEventListener('input',debounce((e)=>{
searchTerm=e.target.value;
loadAllVideo(sortBy,searchTerm)
},500))