title: javascript variable pointers inside functions
body: <p>So here's a strange one:</p>
  
  <pre><code>var a = true;
  function f(v){ v = !v; }        //can this function actually change a?
  f(a);   //a is still true..         
  </code></pre>
  
  <p>The function obviously changes only the value if it's internal <em><code>v</code></em> variable.</p>
  
  <p>I came across this working on an application that should change the values of properties of <code>DOM</code> Elements dynamically at run time. So ideally there should be a function that takes a property as an argument and reassigns it, right?</p>
  
  <p>for clarity - I am actually trying to assign new values to DOM element's attributes at runtime: I have a reflector application that iterates through members of objects and I want it to be able to change the value of properties that it comes across, so the f function would belong to a BooleanSwitch constructor function that builds a booleanSwitch object for every boolean type property in the reflected object. the booleanSwitch can be a simple button on screen. I want to be able to change the value of the actual property of the object at hand just by clicking the button..
  can anyone think of a way to do this?</p>
  
  <p>Any thoughts are appriciated.. </p>