原型继承

    // ES5继承:prototype
    function User(username,password){
        this.username = username
        this.password = password
        this.login = function () {
            console.log("登录")
        }
    }

    function Admin(){
        this.deletePerson = function(){
            console.log("删除一个用户")
        }
    }

    Admin.prototype = new User()
    let admin = new Admin
    admin.login()
原型链
    // 原型链 
    function User(username,password){
        this.username = username
        this.password = password
    }

    function Admin(){
        this.deletePerson = function(){
            console.log("删除一个用户")
        }
    }

    Object.prototype.login = function() {
        console.log("object原型上的登录方法")
    }
    Admin.prototype = new User()
    let admin = new Admin
    admin.login()