面试题答案
一键面试class MathUtils {
constructor() {
const privateData = new WeakMap();
privateData.set(this, {
_secretValue: 'This is a secret'
});
this.getSecret = () => {
return privateData.get(this)._secretValue;
};
}
static add(a, b) {
return a + b;
}
}