var my_obj = {};
var my_array = [];
var j= "10";
var k = "5";
var subject = "10";
var klass = "Math";
for (i= 1; i< j; i++) {
for (k = 0; c < k; k++) {
if (k== 1) {
var first = "hello" + row;
}
if (k== 2) {
var second = subject + k; //var hello1 = subject + k; -- I would like to have "hello1" which is here the first variable value!
}
if (k==3) {
var hello2 = klass + k;
}
}
my_obj = { first : first, second:second; third:third}; }
}
my_array.push(my_obj);
我想将第二个变量的名称表示为变量的第一个值。例如,我需要将变量名称称为hello1和hello2。如何实现呢?