Is there somthing like an ampersand in c that I can use in javascript to function parameters?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/7744611/pass-variables-by-reference-in-javascript">Pass Variables by Reference in Javascript</a>  </p>
</blockquote>



<p>I desperately look for a solution. I have a javascript project to finish and the only thing that stays in my way is this little thing. I only need something like and ampersand in c to put next to a function parameter so it be passed by reference and it would change outside of the function.</p>

<p>Now I know there are other ways. But in my case this is the only thing that will help me.
This is a program that creates binary search trees and I originally made it in c++ but I need to convert it to javascript cause I will show how the tree is generated while the code executes. This is my project. So to create the binary structure only something like an ampersand would help me.</p>

<pre><code>function nod()
{
    var info;
    var left;
    var right;
}

var rad;
rad = new nod();
rad = null;

function create(rad,x) // create(nod *&amp;rad, int x) in c++
{
    if(rad==null)
    {
        rad = new nod();
        rad.info = x ;
        rad.left = rad.right = null;
    }
    else
    {
        if(x &lt; rad.info)
        {
            create(rad.left,x);
        }
        else
        { 
            create(rad.right,x);
        }
    }
}

function read(rad) // read(nod *&amp;rad) in c++
{
    var input = [
                    0,
                    10,
                    2,
                    1,
                    8,
                    9,
                    4,
                    5,
                    3,
                    6,
                    20,
                    11,
                    30,
                    21,
                    31,
                    22,
                    23,
                ];
    var i;
    for(i=1;i&lt;=16;i++)
    {
        create(rad,input[i]);
    }
}

read(rad);
</code></pre>
