努力做好自己,学习并进步

数据类型

 

 

 

//示例
var tags1avg= ['rg2_crt_001_001_avg', 'rg2_crt_001_002_avg', 'rg2_crt_001_003_avg', 'rg2_crt_001_004_avg', 'rg2_crt_001_005_avg',
                    'rg2_crt_cen_000_avg', 'rg2_crt_003_005_avg', 'rg2_crt_003_004_avg', 'rg2_crt_003_003_avg', 'rg2_crt_003_002_avg','rg2_crt_003_001_avg'];
var tagname=tags1avg[0]
console.log("1:",tagname)//打印的是rg2_crt_001_001_avg
console.log("2:",data[1].tagname)//2: undefined
console.log("3:",data[1].tags1avg[0])//3: undefined
console.log("4:",tags1avg[0])//3: rg2_crt_001_001_avg
console.log("5:",data[1].rg2_crt_001_001_avg)//5: 0: {value: 144.6, key: "2020-11-13 07:59:59.0"}

怎么让代码中data[1].tagname或者data[1].tags1avg[0]有数据?

  使用

data[1][tagsvag[0]]

 

再伟大的梦想,也抵不住傻瓜式的坚持@psl