标签:原型链
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"
标签:原型链
原文地址:http://blog.51cto.com/ltzbk/2095315