js通过字符串匹配变量

2025-03-06 19:15:11
推荐回答(1个)
回答1:

var L8=10,L9="XY",L10="sdf";

var str="8";
var tmp=eval("L"+str);
console.log(tmp);