const inputDom = document.querySelector('input')
// inputDom.addEventListener('input', function(e) {
// console.log(e.target.value)
// })
function Dedobble(fn, delay) {
let timeId = null
return function(...args) {
clearTimeout(timeId)
timeId = setTimeout(() => {
fn.call(this, ...args)
}, delay)
}
}
inputDom.addEventListener('input', Dedobble(function(e){
console.log('123', e.target.value)
}, 1000))
<input />