I have a string that I'm trying to use as the name of a function in Jquery 2.2. Here's what that looks like:
var barBaz = 'myFunctionName';
Then I have a function which I want to call, which looks like this:
myFunctionName.changeView('success');
When I call this function directly, it works. But when I try this:
[barBaz].changeView('success');
I get this error:
Uncaught TypeError: [...].changeView is not a function
Obviously I'm missing something in my understanding of the syntax to use a string as the name of a function. (I also attempted the window[barBaz] approach with no better success) Where am I going wrong?