How do I fix the problem with the capitalization checker?

I have a one problem. This my TodoList Project: (Please Check The Link İf you want to better understand the problem.) I’m trying to prevent the same words from being added to the list as items. I’m trying to control it with the “toLowerCase” command inside. But it keeps adding the same words because their letter sizes are different, for example: “Berkay” “berkay” I want these two words not to be included even if their letter sizes are different.

function addTodo(e) {
    const newTodoValue = todoInput.value.trim();
    const newTodoValuee = todoInput.value.trim().toLowerCase();
    let todos = getTodosFromStorage();
    if (newTodoValue === "") {
    } else if (todos.includes(newTodoValuee)) {
        console.log("Aynı Todo");
        todoInput.value = "";
        return false;
    } else {

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like