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_原型链
URL网址:http://ybzwz.com/article/geeees.html