<input type="text" id="inp">
var oInp = document.querySelector("#inp");
const debounce = function (fn, delay) {
let timer
return function () {
clearTimeout(timer)
timer = setTimeout(fn, delay)
}
}
let init = 0
oInp.oninput = debounce(function () {
init++
console.log(init);
}, 500)