本文共 431 字,大约阅读时间需要 1 分钟。
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"
转载于:https://blog.51cto.com/ltzbk/2095315