function Product(name){ this.name = name || 'apple' this.price = function(){ this.name + '18' } } Product.prototype.size = function(a){ console.log(this.name + a) } function subProduct(name){ Product.call(this) this.name = name || 'tom' } subProduct.prototype = new Product() var b = new subProduct() console.log(b.name) console.log(b.size(123)) //函数可复用,可传参,可继承实例属性和方法也可继承原型实例属性和方法