It's frustrating that despite all my efforts, I'm still stuck on implementing a small feature for the past 5-6 hours. I need assistance with storing a single variable in the user's localStorage, initially set to 1. When the user clicks a button, the localStorage value switches between 0 and 1, toggling between light and dark mode on the website. The code for the button can be found in the second try or my previous StackOverflow post.
Here are some of my attempts at implementation:
Code working without local storage, initial value 0:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
... (remaining code)
</body>
</html>
EDIT:
Integration of solution into project:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
... (updated content)
</body>
</html>