function memorize(fn){
const memory = [
{
args: [3, 4],
result: 7
},
{
args: [1, 3],
result: 4
}
];
return fn;
}
const resultFunction = memorize((s) => s**2);
console.log(resultFunction(4));
function memorize(fn){
...
return (...args) => {
// args
return fn(...args);
}
}