javascript dynamic prototype
<p>I want extend a new JS object while creation with other object passing a parameter.
This code does not work, because I only can extend object without dynamic parameter.</p>

<pre><code>otherObject = function(id1){
    this.id = id1;
};

otherObject.prototype.test =function(){
    alert(this.id);
};

testObject = function(id2) {
    this.id=id2;
};

testObject.prototype = new otherObject("id2");/* id2 should be testObject this.id */


var a = new testObject("variable");
a.test();
</code></pre>

<p>Any suggestion?</p>
