我目前正在用 JS 构建一些东西,并遇到了以下场景:
// these are set programmatically, not like this, just using as an example
var data = {'someData':'blah'};
var widget = 'NameOfWidget';
var command = 'someFunctionName';
// there is a base object that has all widgets and their commands as child objects
// format would be like: UBER.WidgetName.command(data);
// here is how I have tried to call it thus far
UBER[widget][command](data);
window['UBER'][widget][command](data);
我觉得我快要弄清楚了,只需要一点帮助来弄清楚确切的语法!谢谢!