Adding new methods and values to an object while avoiding repetition
<p>I'm struggling to learn object oriented javascript. I have an object constructor that looks like this:</p>

<pre><code>//generic object
function myObject(value1, value2, value3){
this.value1 = value1;
this.value2 = value2;
this.value3 = value3;
this.method1 =method1;
}

function method1(){
alert('hello');
}

function method2(){
alert('hello again');
}
</code></pre>

<p>I'm creating new instances of this object like this:</p>

<pre><code>instance1 = new myObject(
1, //value1
2, //value2
3  //value3
)
</code></pre>

<p>My problem is this: On a few instances of myObject I need custom values and methods. I would like to add them at the point of creation. But I can't figure out how to do it without writing the instance name again, which I'm trying to avoid since it would significantly slow down the process of adding new objects.</p>

<p>Is there some way to replace this code..</p>

<pre><code> instance1 = new myObject(
 1, //value1
 2, //value2
 3  //value3
 )
 instance1.method2 =method2;
 instance1.value4 =4;
</code></pre>

<p>..with something that doesn't require repeating the name "instance1"?</p>
