如何获取JavaScript变量值?

时间:2019-05-10 12:07:23

标签: javascript

var param = "statut";

// I want this expression :

data.param.function1().function2();

// to be equivalent to :

data.statut.function1().function2();

1 个答案:

答案 0 :(得分:4)

尝试使用:

var param = 'status';
data[param]function1().function2()