title: correctly resetting a global variable in javascript?
body: <p>so, in <strong><em><a href="https://stackoverflow.com/questions/1232040/how-to-empty-an-array-in-javascript">this post here</a></em></strong> people are discussing the fact that</p>
  
  <pre><code>A = [1,2,3];
  </code></pre>
  
  <p>and then doing</p>
  
  <pre><code>A = [];
  </code></pre>
  
  <p>will not reset the array but create a new one.</p>
  
  <p><strong><em>My question is</em></strong>, if I use a global object variable</p>
  
  <pre><code>myglobals = { A : [] }
  </code></pre>
  
  <p>Can I safely reset the array with</p>
  
  <pre><code>myglobals.A = [];
  </code></pre>
  
  <p>Right? Since that's referencing the same object property and thus I'm not actually creating a new array, am I?</p>
  
  <p><strong>Update to question due to remarks below</strong></p>
  
  <p>Since there is a general consensus that <code>splice(0)</code> is the way to go, and since a very similar question has an answer that explains the impact to browser freeing up memory, I'm wondering if it's generally safe and proper to set any defined object (whether array or function or string, etc...) to <code>null</code> in order to reset it's <em>value</em> while retaining it's <em>reference</em>?</p>