title: If a is false, then does if(a) === if(false)?
body: <p>I am working on a JavaScript exercise on an interactive website, and I just really need some assistance in understanding the logic behind this...</p>
  
  <p>The exercise asks that you define a variable programming, and set it equal to false.</p>
  
  <p><code>var programming = false;</code></p>
  
  <p>Then, if programming equals false, a function, <code>happy</code> is to return true.</p>
  
  <p><code>programming</code> has already been set to false, so my first thought was to just write:</p>
  
  <pre><code>if (programming) {
      // this
  </code></pre>
  
  <p>I made the mistake of not using the ! operator, which is what they were requesting, so I then tried to write:</p>
  
  <pre><code>if (!!programming) {
      // this
  </code></pre>
  
  <p>To me, this says: <code>not not false</code> which I thought would cancel out and equal <code>false</code></p>
  
  <p>But I get the following error:</p>
  
  <blockquote>
    <p>Oops, try again. It looks like your happy function returns true instead of false when programming is true</p>
  </blockquote>
  
  <p>this works:</p>
  
  <pre><code>if (!programming) {
      // this
  </code></pre>
  
  <p>I'm just not understanding why (!programming) evaluates to false, when I believe this is basically saying: (!false)</p>
  
  <p>Please help me understand the error of my ways. Thank you.</p>
  
  <hr>
  
  <p>For a reference, here is my full code:</p>
  
  <pre><code>var programming = false;
  var happy = function() {
    if (!programming) {
        return true;
    } else {
        return false;
    };
  };
  </code></pre>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>I've found the solution. zystvan explains it on this post: <a href="https://discuss.codecademy.com/t/why-is-this/42458" rel="nofollow">https://discuss.codecademy.com/t/why-is-this/42458</a></p>