How to extend array or object prototype for a specific javascript object?
<p>Say I have the following:</p>

<pre><code>function Myobj = {
   name: "Julia",
   birthdate: "xxxx",
   genres: [],
   movies: [{title: "movie1", rating: 5, genre: "Horror"}, {title: "movie2", rating 3, genre: "Comedy"},{title: "movie3", rating 3, genre: "Comedy"}, {title: "movie4", rating 3, genre: "Comedy"}, {title: "movie5", rating 3, genre: "Horror"}]
}
</code></pre>

<p>What I want to be able to do is have some function like:</p>

<pre><code>Myobj.prototype.pushMovie(somejson) {
   // code to add somejson to "movies", and add the "genre" to the "genres" array
}
</code></pre>

<p>Such that I can go:</p>

<pre><code>obj1 = new Myobj();
obj1.pushMovie({title: "movie1", rating: 5, genre: "Horror"});
</code></pre>

<p>Or is it better practice to override the array prototype? If so, is it possible to give a prototype a specific array as opposed to all arrays like:</p>

<pre><code>Myobj.Array.prototype.pushMovie() {
// code to inherit from regular push, and do some operation to add to "genres"
}
</code></pre>

<p>I do not know what the syntactically correct or best approach is.</p>
