var a= "user passed name/ value from run time" // assume it is: xValue
var xValue="some value" //x must be value of a
//ie "user passed name/ value from run time" = some value
在x等于a的值时如何实现?
答案 0 :(得分:0)
var a="xValue";
this[a]="some value"; //window[a] if scope of this is not global.
console.log(xValue);
这就是我想要的。经过一整天的努力,我终于明白了。