这是我的代码
const myFunction = function(number){
this.number = number;
const foo = () => {
return this.number;
}
myFunction.prototype.log = function () {
console.log(foo());
}
}
let firstInstance = new myFunction(12);
let secondInstance = new myFunction(13);
firstInstance.log() // 13
secondInstance.log() // 13
当我使用 foo 函数时,返回最后一个实例;
有没有办法在函数原型中使用私有函数和日志函数