Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript-将动态字符串分配给变量_Javascript_Jquery - Fatal编程技术网

Javascript-将动态字符串分配给变量

Javascript-将动态字符串分配给变量,javascript,jquery,Javascript,Jquery,我需要赋值以从动态字符串中提取变量的名称 前。 这就是赖特: Item.text = localizedStrings.report_label; 这是错误的: var localizedName = "localizedStrings.report_".concat(tempList[index].Name); Item.text = localizedName; 有人能告诉我怎么做吗 尝试使用:- 当然,secont部分在一个周期内 var localizedName = locali

我需要赋值以从动态字符串中提取变量的名称

前。 这就是赖特:

 Item.text = localizedStrings.report_label;
这是错误的:

var localizedName = "localizedStrings.report_".concat(tempList[index].Name);
Item.text = localizedName;
有人能告诉我怎么做吗

尝试使用:-


当然,secont部分在一个周期内
var localizedName = localizedStrings["report_" + tempList[index].Name];
Item.text = localizedName;