如何创建存储在动态变量中的动态列名推送数据

时间:2018-09-17 09:46:41

标签: javascript angularjs

  

每日更改列名称
     年,模型1,模型2,模型3,模型4,模型5,模型6更改随机列
     名称YEARS,model9,model8,model1,model4,model2,model10

var Data=[{"YEARS":"2012","model1":"6","model2":"2","model3":"0","model4":"0","model5":"0","model6":"0"}]

这里是我的静态列名-

for (var i = 0; i < Data.length; i++) {
  Model1.push(Data[i].model1);
  Model2.push(Data[i].model2);
  Model3.push(Data[i].model3);
  Model4.push(Data[i].model4);
  Model5.push(Data[i].model5);
  Model6.push(Data[i].model6);
  Allyears.push(Data[i].YEARS);
}

动态列名推送和变量

0 个答案:

没有答案