How to instantiate a class(ClassA) inside another class(ClassB) and use the ClassA object as a property in ClassB in JavaScript?
<p>Consider the following code:</p>

<pre><code>function Coord(x, y) {
    this.x = x;
    this.y = y;
}

function Ellipse() {
    this.Text = Text;
    this.Cx = Cx;
    this.Cy = Cy;
    this.Rx = Rx;
    this.Ry = Ry;
}
</code></pre>

<p>Now in the function <code>Ellipse</code>instead of using <code>Cx</code>, <code>Cy</code> etc. I want to instantiate the function <code>Coord</code> for each pair to achieve something as follows:</p>

<pre><code>function Coord(x, y) {
    this.x = x;
    this.y = y;
}

function Ellipse() {
    this.Text = Text;
    Coord C = new C(); // where C has its own properties x and y
    Coord R = new R(); // where R has its own properties x and y
}
</code></pre>
