I want to write function that takes a function name as an argument and calls it. Normally i could do this using window[funcname]. However all my code is enclosed within an anonymous function and hence the namespace of the function is now window. In this case how could i write this function.
Share
You could assign your functions to properties of an object:
You can then call
func1just like you suggest, but replacingwindowwithmyFuncs, like so: