I was trying to figure this out with a friend.
Let's say you have a function like this:
const foo = function(i) { return function(j){ return 2 * j } };
How would I override foo
with a different method?
Let's say I want to reuse foo
with a different anonymous function that does something like function(j){ return 3 * j; };
How would I do that?
EDIT: I saw this post, but that's for variables. I'm asking specifically about anonymous methods.
EDIT 2: This is a proof of concept, so let's say that foo
is a const
and I can't turn it into a let