var SomeConstructor = function(name, age, friends) {
this.name = name;
this.age = age;
this.friends = friends;
};
SomeConstructor.prototype.getName = function () {
return this.name;
};
SomeConstructor.prototype.addAge = function () {
return this.age++;
};
SomeConstructor.prototype.addFriends = function (friend) {
return this.friends.push(friend);
};
var some1 = new SomeConstructor("a", 30, []);
var some2 = new SomeConstructor("b", 30, []);
some1.addAge();
some2.addFriends("gosha");
alert(JSON.stringify(some1,'',2));
alert(JSON.stringify(some2,'',2))
Эх, долго писал