This is my code:

    function search() {
        $("#myInput").keyup(function() {
            var value = this.value.toLowerCase();
    
            $("table").find("tr").each(function(index) {
                if (index === 0) return;
                var id = $(this).find("td").first().text().toLowerCase();
                $(this).toggle(id.indexOf(value) !== -1);
            });
        });
    }
    
    function searchFilt(value) {
        $("table").find("tr").each(function(index) {
            if (index === 0) return;
            var id = $(this).find("td").first().text();
            $(this).toggle(id.indexOf(value) !== -1);
        });
    };

However I have used:

    $("table").find("tr").each(function(index) {
                if (index === 0) return;
                var id = $(this).find("td").first().text().toLowerCase();
                $(this).toggle(id.indexOf(value) !== -1);
            });
        });

twice, and I am sure there would be a more effective way to do this. However I am not sure how to go about doing so - any advice?