title: JavaScript global boolean Variable convert itself to string
body: <p>first I'm new to Javascript, so please don't hate me if I ask such an trivial question.</p>
  
  <p>I've searched some hours on Google, but I cannot find a solution for my Problem. I have declared a global Variable "status", which is false. But if I check the datatype within a function, it says "string", which is allways true, so that my Script doens't work at all.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var status = false;
  
  function slide(element) {
      if (status) {
          slideUp(element);
      } else {
          slideDown(element);
      }
  }
  
  function slideDown(element) {
      status = true;
      // Testprint todo remove
      alert('Status is ' + status + ' and is type: ' + typeof status);
      // todo
  }
  
  function slideUp(element) {
      status = false;
      // Testprint todo remove
      alert('Status is ' + status + ' and is type: ' + typeof status);
      // todo
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Am I wrong or have I write myself a function to convert every time a boolean var to a "real" boolean var? I have tested it by myself and this show me boolean datatype...</p>
  
  <p>This works fine...
  <div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var test = false;
  myTestFunc();
  
  myTestFunc() {
      if(!test) {
        test = true;
        alert('Test is false');
      } else {
        test = false;
        alert('Test is true');
      }
      
      alert('Test contains: ' + test + ' and has the type: ' + typeof test);
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I see, that Javascript seems to randomly declare Variables. Is there a solution to make my Variable to a boolean datatype?</p>
  
  <p>Better is there a chance to force the initialation to boolean like <code>int varname</code>?</p>