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"
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。