title: How to use switch and console.log?
body: <p>I am setting up greetings based on the time of the day and writing them to console using the log() method.</p>
  
  <p>I have tried them in the following two ways</p>
  
  <pre><code>const now = new Date(); //Display's Date
  
  switch (true) {
      case (now &lt;= 12):
          console.log("Good Morning");
          break;
      case (now &gt; 12 &amp;&amp; now &lt; 16):
          console.log("Good Afternnon");
          break;
      case (now &gt;= 16 &amp;&amp; now &lt; 20):
          console.log("Good Evening");
          break;
      case (now &gt;= 20 &amp;&amp; now &lt;= 24):
          console.log("Good Night");
          break;
  }
  
  
  switch (now &lt;= 12) {
      case true:
          console.log("Good Morning");
  }
  switch (now &gt; 12 &amp;&amp; now &lt;= 16) {
      case true:
          console.log("Good Afternnon");
  }
  switch (now &gt;= 16 &amp;&amp; now &lt;= 20) {
      case true:
          console.log("Good Evening");
  }
  switch (now &gt;= 20 &amp;&amp; now &lt;= 24) {
      case true:
          console.log("Good Night");
  }
  </code></pre>
  
  <p>How do I solve this problem? </p>