<script>
const niasswitchElement = document.querySelector('.theme-switch__checkbox')

niasswitchElement.addEventListener('click', function () {
  // Hint: Add 'dark' class to body :))

  document.body.classList.toggle('dark')

  if (document.body.className.includes('dark')) {
    localStorage.setItem('theme', 'dark')
  } else {
    localStorage.setItem('theme', 'light')
  }

  // console.log(document.body.className.includes('dark'));  // Boolean
})


window.onload = function () {
  let localStorageTheme = localStorage.getItem('theme')
  if (localStorageTheme === 'dark') {
    document.body.classList.add('dark')
    document.getElementById('themeSwitch').checked = true;
  }

}
          
      </script>