function test(name){
this.name = name;
this.say = function(){
console.log('say');
}
this.getProtoName = function(){
return test.prototype.name
}
}
// 设置原型上的方法和属性
test.prototype.name='prototype name'
test.prototype.say= function(){
console.log('prosay');
}
test.prototype.jump= function(){
console.log('jump');
}
var t = new test('test')
t.say()// ‘sya' 自己有这个方法,原型上也有,此时调用自己的
t.jump() // 'jump' 自己没有这个方法,调用原型上的
t.getProtoName() // 'prototype name' 获取原型上的name属性
test.prototype.say() // 'prosay' 直接调用原型上的