title: boolean in an if statement
body: <p>Today I've gotten a remark about code considering the way I check whether a variable is true or false in a school assignment.</p>
  
  <p>The code which I had written was something like this:</p>
  
  <pre><code>var booleanValue = true;
  
  function someFunction(){
      if(booleanValue === true){
          return "something";
      }
  }
  </code></pre>
  
  <p>They said it was better/neater to write it like this:</p>
  
  <pre><code>var booleanValue = true;
  
  function someFunction(){
      if(booleanValue){
          return "something";
      }
  }
  </code></pre>
  
  <p>The remark which I have gotten about the "=== true" part was that it was not needed and could create confusion.</p>
  
  <p>However my idea is that it is better to check whether the variable is a boolean or not, especially since Javascript is a loosetyped language.</p>
  
  <p>In the second example a string would also return "something";</p>
  
  <p>So my question; Is it neater to loose the "=== true" part in the future, or is it good practise to check the type of the variable as well.</p>
  
  <p><strong>Edit:</strong>
  In my "real" code the boolean represents whether an image has been deleted or not, so the only values boolValue should ever have is true or false.</p>
  
  <p>0 and 1 for example shouldn't be in that variable.</p>