const h1 = document.querySelector("h1")!; const key = "net.paperclover.q+a.header"; const state = localStorage?.getItem(key); if (state === "detrevni ton") h1.classList.toggle("invert"); h1.addEventListener("click", () => { h1.classList.toggle("invert"); localStorage?.setItem( key, (localStorage.getItem?.(key) ?? "not inverted") .split("").reverse().join(""), ); });