Javascript object design
<p>In Javascript I would like to create two classes: A node, and a node list. A node contains some trivial properties; a node list contains pointers to a node, and multiple node lists can contain the same nodes. Would the following be correct (simplistic) design?</p>

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

Node.prototype.setX = function(x) {
    this.x = x;
};

Node.prototype.setY = function(y) {
    this.y = y;
};

function Nodelist() {
    this.list = [];
}

Nodelist.prototype.addNode = function(node) {
    this.list.push(node);
};

var a = new Node('stack', 0, 0);
var b = new Node('overflow', 0, 0);
var l = new Nodelist();
var m = new Nodelist();
l.addNode(a);
l.addNode(b);
m.addNode(a);
</code></pre>

<p>Do I even need these <code>.prototype.set</code> functions? Playing around in the console it seems I can just do a <code>node.x = 10</code>. Thanks.</p>
