In JavaScript, how could you create a new function with the same name as an existing function, while also preserving the original function so it could be called from within the new one?
Alias method chain in JavaScript?
1.2k Views Asked by AudioBubble At
3
You can pass the original function into an anonymous function which returns a replacement function which has access to the original function.
E.g.
Example output: