Solution 1 :

You can put an integer in your alert function and every using array increase a one more.
For example, if you want after 5 times don’t show alert.

   var a = 0;
    var b = true;
if (newTodo === "" || b) { // Alarm Verme
        showAlert("danger","Please Give me a Todo!");
if(a == 5 ){
    b = false;

Problem :

when I click on the “Todo Ekleyin” button, I get a warning. However, I would like this alert to appear only once per press, not multiple times, and can be pressed again after the alert disappears. How can I achieve this and?
Thank you in advance for your answer, good work. (If there is a method other than the method you suggested, I would be glad if you can write its name.)

// Tüm Elementleri Seçme

const form = document.querySelector("#todo-form");
const todoInput = document.querySelector("#todo");
const todoList = document.querySelector(".list-group");
const firstCardBody = document.querySelectorAll(".card-body")[0];
const secondCardBody = document.querySelectorAll(".card-body")[1];
const filter = document.querySelector("#filter");
const clearButton = document.querySelector("#clear-todos");


function eventListeners() { // Tüm Event Listenerlar
    form.addEventListener("submit", addTodo);

function addTodo(e) {
    const newTodo = todoInput.value.trim();

    if (newTodo === "") { // Alarm Verme
        showAlert("danger","Lütfen Bir Todo Giriniz");
    else {



function showAlert(type,message){
    const alert = document.createElement("div");
    alert.className = `alert alert-${type}`;
    alert.textContent = message;


    }, 1000);

function addTodoToUI(newTodo) { // String Değerini List Item olarak Ekleyecek.
    // List Item Oluşturma.
    const listItem = document.createElement("li");
    // Link Oluşturma
    const link = document.createElement("a");
    link.href = "#";
    link.className = "delete-item";
    link.innerHTML = "<i class = 'fa fa-remove'></i>";
    listItem.className = "list-group-item d-flex justify-content-between";
    // Text Node

    // Todo List'e List Item'ı Ekleme
    // Ekleme Sonrası Input'tan yazı Silme
    todoInput.value = "";

// Todo Ekleme Bilgi Mesajı
<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="stylesheet" href="" />
    <link rel="stylesheet" href=""
        integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" />

    <title>Todo List</title>

    <div class="container" style="margin-top: 20px">
        <div class="card row">
            <div class="card-header">Todo List</div>
            <div class="card-body">
                <form id="todo-form" name="form">
                    <div class="form-row">
                        <div class="form-group col-md-6">
                            <input class="form-control" type="text" name="todo" id="todo"
                                placeholder="Bir Todo Girin" />
                    <button type="submit" class="btn btn-danger">Todo Ekleyin</button>
                <hr />
                <!-- <div class="alert alert-danger" role="alert">
                    This is a danger alert—check it out!
                </div> -->

            <div class="card-body">
                <hr />
                <h5 class="card-title" id="tasks-title">Todolar</h5>
                <div class="form-row">
                    <div class="form-group col-md-6">
                        <input class="form-control" type="text" name="filter" id="filter"
                            placeholder="Bir Todo Arayın" />

                <hr />
                <ul class="list-group">
                    <!-- <li class="list-group-item d-flex justify-content-between">
                            Todo 1
                            <a href = "#" class ="delete-item">
                                <i class = "fa fa-remove"></i>

                <hr />
                <a id="clear-todos" class="btn btn-dark" href="#">Tüm Taskları Temizleyin</a>

    <script src=""
        integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous">
    <script src=""
        integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous">
    <script src=""
        integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous">
    <script src="berkay.js"></script>



Comment posted by OyeeBerkay

Thanks Ilkay but it’s doesn’t work. Maybe i put it in the wrong place.