title: Changing the background-color at different hours of the day in JavaScript?
body: <p>How can I change the <code>body</code> background color at different times of the day?</p>
  
  <p>This is my script, but nothing is showing on my page. I am really new to JavaScript. Can you explain what's wrong?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var t = date("H");
  
  if (t &lt; "10") {
      console.log("Have a good morning!");
      document.body.style.backgroundColor = "yellow";
  } elseif (t &lt; "20") {
      console.log("Have a good day!");
      document.body.style.backgroundColor = "red";
  } else {
      console.log("Have a good night!");
      document.body.style.backgroundColor = "blue";
  }</code></pre>
  </div>
  </div>
  </p>