the important thing is not to stop questioning

导航

 

        //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();

posted on 2016-04-01 16:42  qook  阅读(278)  评论(0编辑  收藏  举报