return function(x) {
.function decorator(func) {
let cache = new Map();
return function decoratedFunc(x) {
if (cache.has(x)) {
return cache.get(x);
};
let result = func.call(this, x);
cache.set(x, result);
return result
}
}
obj.fac = decorator(obj.fac); // obj.fac === decoratedFunc