I'm just beginning with JavaScript, but I've searched and read about the js variable scope, and can't figure this out.
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:
var counter = 0;
goNext();    
function goNext()
{   
    if(counter = 0)
    {
        counter = 3;
    }
}
alert('I now want counter to be 3! How?');
 
     
    