leibnizli / leibnizli.github.com

just a blog!
https://leibnizli.github.io
0 stars 0 forks source link

about me #25

Closed leibnizli closed 3 months ago

leibnizli commented 3 years 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)
})();