Function constructor
var Constr = function(name) {
this.name = name;
this.method1 = function() {
return 'Method #1';
}
}
Constr.prototype.method2 = function() {
return 'Method #2';
}
var a = new Constr('Ваня');
console.log(a.name);
console.log(a.method1());
console.log(a.method2());