function Shape() {
}
Shape.prototype.duplicate = function() {
console.log('duplicate')
}
function Circle(radius) {
this.radius = radius
}
Circle.prototype = Object.create(Shape.prototype)
Circle.prototype.draw = function() {
console.log('draw')
}
const s = new Shape()
const c = new Circle(1)
JSOOP Object.create 从给定的原型创建对象
最新推荐文章于 2023-08-30 09:35:41 发布