我不知道如何以编程方式执行此操作:
var a={a:"a",b:"b"};
return a.a;
|
I want to change this programmatically, how can I do that?
不使用eval()
?
最佳答案
使用 a[v]
其中 v
是一个变量,这些值是 'a'
或 'b'
.
关于javascript - 我如何以编程方式执行此操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9187389/