title: Setting global variable value within functions & if statements
body: <p>I'm just beginning with JavaScript, but I've searched and read about the js variable scope, and can't figure this out.</p>
  <p>I want to be able to set a variable value declared outside any function, within the functions which also contains if-statements. But yet it does not change the global variable. Example:</p>
  <pre><code>var counter = 0;
  goNext();    
  
  function goNext()
  {   
      if(counter = 0)
      {
          counter = 3;
      }
  }
  
  alert('I now want counter to be 3! How?');
  </code></pre>