title: Javascript repeated use of "new" with same target variable
body: <p>I think this is OK but I would like confirmation.</p>
  
  <p>In Javascript can I repeatedly assign a new object to the same variable without causing memory leaks or other problems?</p>
  
  <p>Example:</p>
  
  <pre><code>var rect = new Rectangle(left1, top1, width1, height1);
  ...
  ...
  ... // some stuff
  ...
  rect = new Rectangle(left2, top2, width2, height2); // change the rect size
  ...
  ...
  ... // some other stuff
  ...
  rect = new Rectangle(left3, top3, width3, height3); // change the rect size again
  </code></pre>
  
  <p>The Rectangle class just holds a representation of a rectangle, including a few parameters calculated from the passed ones. I think the garbage collection will take care of it but as a C++ chap that repeated use of "new" makes me nervous!</p>