There is like 5 questions already answered but all of them says only how to create, what I need is to access. In PHP we have:
$foo = new Foo();
$bar = 'methodName';
$foo->{$bar}();
How can I do this in JavaScript without using plugins? Code below fires method 'bar' of object 'foo', but I need to fire method from 'foo' object which name is assigned to variable 'bar'.
var foo = new Foo(),
bar = 'methodName';
foo.bar();