title: JS: incremental counter without setting a counter variable in the global scope?
body: <p>I'm trying to set an internal counter that adds 1 every time the user clicks on a link that triggers an onclick function. It starts at 0 and everytime the user clicks on the link the counter will increase by 1 (or whatever integer you want). The counter should reset to 0 upon refresh and the variable that holds the integer value cannot be declared in the global scope.</p>
  
  <p>I keep running into the catch22 of how to initially declare the variable without this declaration being repeated everytime the function runs, essentially setting the counter value back to the original value.</p>