1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function Fu() { this.name = '小明'; } Fu.prototype.showName = function() { alert(this.name); } function Zi(){ Fu.call(this); }
var F = function(){} F.prototype = Fu.prototype; Zi.prototype = new F();
Zi.prototype.constructor = Zi; var zi = new Zi(); zi.showName();
|