• js练习 原型


            //var a = {
            //    fun: function a() {
            //        test = 0;
            //        alert(this);
            //        b();
            //        function b() {
            //            alert(this);
            //            var v = 0;
            //        }
            //    }
            //};
            //a.fun();

            Function.prototype.method = function (name, func) {
                //alert(this);
                this.prototype[name] = func;
                return this;
            };
            var test = function () {
                this.value = 0;
                alert('test');
            }
            test.prototype.method1 = function () {
                alert('method1');
            };
            
            //var method1= Function.method("method1", function () {
            //    alert('method1');
            //    alert(this);
            //    method2();
            //    function method2() {
            //        alert(this);
            //    }
            //})
            //test.method1();


            var test2 = function () {

            };
            test2.prototype = new test();
            var test2Instance = new test2();
            alert(test2Instance.value);

            //test.method1();

            //alert('1');
            //Function.method1();
            //method1.method1();

  • 相关阅读:
    python 复杂一点的装饰器
    python 装饰器
    python 歌词解析
    ATX 免越狱调试IOS和Android
    OpenCV库文件介绍
    NetEaseGame/ATX 的MD
    带你玩转Visual Studio——带你高效开发
    python 图像识别
    fatal: Authentication failed for又不弹出用户名和密码 解决办法
    lua luna工具库
  • 原文地址:https://www.cnblogs.com/qook/p/5345431.html
Copyright © 2020-2023  润新知