Vanilla js throttled search

<input type="search" oninput="search(this.value)">

<script>
    function search(query) {
        function load() {
            console.log("Loading results for '%s'", query);
        }
        search.timer && clearTimeout(search.timer);
        search.timer = setTimeout(load, 500);
    }
</script>