如何在运行时在没有 eval 的情况下在 Javascript 中组装 var?
var lc = $('.bezeichnung-1').length;
for (var lt = 1; lt <= lc; lt++) {
eval("var neuerwert"+lt+"=0;"); // this works but I don't want to use it because I read that eval is bad
}
var lc = $('.bezeichnung-1').length;
for (var lt = 1; lt <= lc; lt++) {
window["var neuerwert"+lt] = 0; // this does not work
}