JavaScript_原型链

function Fn(){
            this.test1 = function(){
                console.log('test1()');
            };
        }

        Fn.prototype.test2 = function(){
            console.log('test2()');
        };

        var fn = new Fn();

        fn.test1();//"test1()"
        fn.test2();//"test2()"
        console.log(fn.toString());//"[object Object]"
        fn.test3();//报错,"undefined is not a function"

JavaScript_原型链

创新互联公司科技有限公司专业互联网基础服务商,为您提供资阳主机托管高防服务器,成都IDC机房托管,成都主机托管等互联网服务。


新闻名称:JavaScript_原型链
本文地址:http://pwwzsj.com/article/geeees.html