title: How to properly work _around_ Javascript persistence?
body: <p>There is basic persistence of Javascript vars/etc. You call a function/method, and the next time you call that same function/method, it is holding the data from the last time.</p>
  
  <p>You can delete the vars when you are done with them, but that removes the advantage of using the code again for that instance.</p>
  
  <p>So what is the <em>proper</em> way to write code which can be reused, on different elements, inside the same page.</p>
  
  <p>Therefore, I need the ability to write code so that I can point it at several different elements, and then interact with that code segregated for each element.</p>
  
  <p>So in PHP (as an example) I would do:</p>
  
  <pre><code>$element1 = new MyClass();
  $element2 = new MyClass();
  $element3 = new MyClass();
  </code></pre>
  
  <p>in that case it's the same code running in three segregated scopes. How can I do this properly with JS. Even using jQuery's extend() gives me problems.</p>
  
  <p>Thanks.</p>