title: Javascript booleans: false && true results in true
body: <p>I need to disable/enable  a button depending in on the value of some radio groups. These radios are populated by some groovy code becasue I'm using grails, a framework for groovy, that is a superset of java. Well that explanation was to say that the values of the radios are defined as booleans, which is just natural because they correspond to yes/no answers.</p>
  
  <p>Now, to disable/enable this button I use some javascript, but it goes bananas with boolean values. As the title states, on some point I do a logical and between a variable that holds <code>false</code> and another variable that holds <code>true</code></p>
  
  <p>Here is the peice of problematic code:</p>
  
  <pre><code>var actual = true;
  $('.requerido input:radio:checked').each(function() {
      console.log("actual: " + actual);
      console.log("value: " + this.value);
      console.log("actual and value: " + (actual &amp;&amp; this.value));
      actual = actual &amp;&amp; this.value;
      console.log("actual: " + actual);
  });
  </code></pre>
  
  <p>As you can see I use the console.log for debugging, and this is what throws at some point:</p>
  
  <pre><code>actual: true
  value: true
  actual and value: true
  actual: true
  
  actual: true
  value: false
  actual and value: false
  actual: false
  
  actual: false
  value: true
  actual and value: true
  actual: true
  </code></pre>
  
  <p>So true &amp;&amp; false == false, but false &amp;&amp; true == true ? Note that the values have no quotes, so they are boolean values (I'm debugging using the Chrome console which represent strings inside double quotes, so you can distinguish between true and "true").</p>
  
  <p>Any ideas?</p>
  
  <p>Also, doing a manual comparison like <code>var x = true &amp;&amp; false</code> always works as expected, is juts with variables that the problem is present.</p>