javascript object properties as parameters
<p>If in javascript object properties are passed by reference why  this doesnt work:</p>

<pre><code>var myObj={a:1}

function myFun(x){
x=2;
}

myFun(myObj.a);

// value myObj.a is still 1
</code></pre>

<p>but on the other hand if you do this:</p>

<pre><code>var myObj={a:1}

function myFun(x){
x.a=2;
}

myFun(myObj);

// this works myObj.a is 2
</code></pre>
