Verifique a existência de cookies 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