function Person(name, age) { this.name = name; this.age = age; }; Person.prototype.sayName = function () { console.log(this.name); }; var person1 = new Person('timo', 3); var person2 = new Person('anni', 1); console.log(person1.name); console.log(person2.name); console.log(person1.sayName()); console.log(person2.sayName());