SOURCE

console 命令行工具 X clear

                    
>
console
const input = document.getElementsByTagName('input')[0]
let timer = null
input.addEventListener('keyup', () => {
    if (timer) {
        clearTimeout(timer)
    }
    timer = setTimeout(() => {
        console.log(input.value)
        timer = null
    }, 500)
})
<input type="text" id="input">