How do I implement something like pointers in javascript?
<p>I know that javascript doesn't have pointers in terms of a variable referring to a place in memory but what I have is a number of variables which are subject to change and dependent on each other.</p>

<p>For example:</p>

<pre><code>Center (x,y) = (offsetLeft + width/scale , offsetTop + height/scale)
</code></pre>

<p>As of now I have rewritten the equation in terms of each individual variable and after any changes I call the appropriate update function.</p>

<p>For example:
If scale changes, then then the center, height, and width stay the same. So I call </p>

<pre><code>updateoffset() {
    offsetLeft = centerx - width/scale;
    offsetTop  = centery - height/scale;
}
</code></pre>

<p>Is this the easiest way to update each of these variables when any of them changes?</p>
