且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将字符串转换为变量名称。 (JavaScript的)

更新时间:2022-10-22 11:17:36

You can't do what you're asking with what you have currently, but it would make more sense to create an object of the models anyway

function Models(Make) {
    var Models = {"Acura": ['RSX','NSX','Integra'] /* snip */};
    return Models[Make][random()];
}