title: Logical operator && and two strings in javascript
body: <p>When I use the logical operator &amp;&amp; between two strings, why does it give me the second string as output:</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>console.log("" &amp;&amp; "Dog");    // ""
  console.log("Cat" &amp;&amp; "Dog"); // "Dog"</code></pre>
  </div>
  </div>
  </p>
  
  <p>I realize that the with the exception of <code>0</code>, <code>false</code>, <code>null</code>, <code>undefined</code>, <code>""</code> and <code>NaN</code>, everything else is evaluated as a boolean true in a logical expression like the one above. But why is the output the second string and not the first? And why is the ouput not just "true" since it is being evaluated as a boolean expression?</p>