• js对象(三)


    js使用祖先元素

    //js的祖先元素 Function
    Function.prototype.addMethod=function(name,fn){
        this[name]=fn;
    }
    var methods = new Function();
    methods.addMethod("checkUser",function(){
        console.log(111);
    });
    methods.addMethod("checkEmail",function(){
        console.log(2222);
    });
    methods.checkUser();
    methods.checkEmail();
    //=========================================================
    //js链式操作
    Function.prototype.addMethod = function(name,fn){
        this[name]=fn;
        return this;
    }
    var methods = new Function();
    methods.addMethod("checkuser",function(){
        console.log(1111);
        return this;
    }).addMethod("checkname",function(){
        console.log(2222);
        return this;
    });
    methods.checkuser().checkname();
    //===========================================================
    Function.prototype.addMethod=function(name,fn){
        this.prototype[name]=fn;
        return this;
    }
    var methods = Function();
    methods.addMethod("checkname",function(){
        console.log(33333);
    }).addMethod("checkuser",function(){
        console.log(4444);
    });
    var m = new methods();
    m.checkname();
    m.checkuser();
  • 相关阅读:
    简单小过一个crc
    BUUCTF-RE-babymips
    为IDA插件findcrypt添加更多规则
    2020网鼎杯第一场青龙组re部分wp
    HexionCTF2020 部分wp
    TGhack2020 re&misc
    java反射总结
    BUUCTF-RE-CrackMe
    青年大学习直接出图片的软件出了bug,用frida干他
    小玩具Teensy
  • 原文地址:https://www.cnblogs.com/zh718594493/p/12185046.html
Copyright © 2020-2023  润新知