Sprawdź, czy ten sam tekst jest powtarzany JavaScript Todo-App

$('#add-items').click(function(event) {
    var item = $('#todo-list-item').val().trim();
    let itemCount = $("#list-items li").filter((i, li) => {
        let text = $(li).text().trim().toLowerCase();
        console.log(text)
    }).length;

    if (itemCount > 0) {
        alert("There is already such a task");
        return;
    }

    if (item && itemCount === 0) {
        $('#list-items').append("<li><input class='checkbox' type='checkbox'/>" + item + "<a class='remove'>x</a><hr></li>");
        $('#todo-list-item').val("");
    }
});
Elated Elk