Skip to content Skip to sidebar Skip to footer

Calling A Function By Name That Is Not Part Of The Global Scope

Let's say I have something like this : var MyApp = MyApp || {}; MyApp.feature = (function($){ var somelocalVariable, otherone init = function() { }, somePrivateFunc

Solution 1:

Replace "window" with "this"

this[functionName]();

Post a Comment for "Calling A Function By Name That Is Not Part Of The Global Scope"