Sprawdź istnienie plików cookie JS

document.cookie = "hacker=anthony; SameSite=None; Secure";

   function checkACookieExists() {
       if (document.cookie.split(';').some((item) => item.trim().startsWith('hacker='))) {
            const output = document.getElementById('a-cookie-existence')
              output.textContent = '> The cookie "hacker" exists'
            }
        }

        function clearOutputACookieExists() {
            const output = document.getElementById('a-cookie-existence')
            output.textContent = ''
        }
Anthony Smith