Closed leibnizli closed 3 months ago
(function() { function object(o) { function F() {} F.prototype = o; return new F(); } function inheritPrototype(subType, superType) { var prototype = object(superType.prototype); prototype.constructor = subType; subType.prototype = prototype; } function Person(name, mail) { this.name = name; this.mail = mail; } Person.prototype.sayName = function() { console.log(this.name); } Person.prototype.sayMail = function() { console.log(this.mail); } function subPerson(options) { Person.call(this, options.name, options.github); this.mail = options.mail; } inheritPrototype(subPerson, Person); var me = new subPerson({ "name": "leibnizli", "mail": "moc.qq#ilzinbiel".split("").reverse().join("").replace("#", "@") }); console.log(me) })();