示例代码:
var name = "test";
var test= ["a","b","c"];
function myFunc (name)
{
//这里通过name得到test对象
}
var name = "test";
var test= ["a","b","c"];
var global_obj={
test:test
}
function myFunc (name)
{
var obj=global_obj[name];
//这里通过name得到test对象
}
试试这个
eval(name).[0]
楼上的更好