2
合理难以描述,可能通过代码最好。使函数的原型构造函数本身
function Base() {}
Base.prototype = function() {
// I am a constructor
}
const baseInstance = new Base()
const secondInstance = new baseInstance() // baseInstance is not a constructor
我知道这将是非常简单的,如果我做了构造的.prototype
命名属性,但我希望能在我的代码做上面的图案。可能吗?