As you can see, I am trying to use the variable counter from a function from one file in a function of another file. I defined counter in the function without beginning it with "var" which I think should make it a global variable. However, it seems it doesn't work. SOS!
//function used in symptoms.html
  function checkboxes(){
    counter = parseInt(document.querySelectorAll('input[type="checkbox"]:checked').length); //counter would be a global var?
    if (counter>=10){
          location.href='end.html';
    }else{
      location.href='state.html';
    }
    }
//function used in another file
    function statedegree(x){
        var conclusion=x*counter;//uses counter var from checkboxes()
         if (conclusion>=18){
           location.href= 'end.html';
         } else{
           location.href='end1.html';
         }
    }
 
     
    