console
var input = document.getElementById('input')
var getInputValuedebunde = getInputValue(1000, fun)
function fun(value) {
console.log(value)
}
input.addEventListener('input', function (e) {
getInputValuedebunde(e.target.value)
})
function getInputValue(delay, fun) {
var timer;
return function (value) {
if (timer) clearTimeout(timer)
timer = setTimeout(function () {
fun(value)
}, delay)
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=">
<meta http-equiv="X-UA-Compatible" content="">
<title>防抖函数的理解</title>
</head>
<body>
<input id='input' placeholder="请输入">
</body>
</html>