title: How to clear JavaScript variables on page reload?
body: <p>I was doing some javascript scope tests and I faced with a problem with the values of the variables.</p>
  
  <p>First I executed this code:</p>
  
  <pre><code>function changeName() {
      name = "Ronaldinho";
  }
  changeName()
  console.log(name);
  </code></pre>
  
  <p>The output in console was: Ronaldinho</p>
  
  <p>Then I performmed only this code:</p>
  
  <pre><code>console.log(name);
  </code></pre>
  
  <p>The output in console still was: Ronaldinho</p>
  
  <p>I was using Google Chrome. I tried to clean cache, all options of page reload (ctrl + F5/ shift + F5 / ctrl + R/ shift + R / Right click in reload icon and "Force reload and clear cache"), clear the cache, console clear, enable de option "Disable cache (while DevTools is open)".</p>
  
  <p>It only works when I close and open a new tab.</p>