let arr = []
//options.series[0].data是一个数组 [21,23,43,17]
for (let i = 0; j < options.series[0].data.length; i++) {
let json = {}
json["b" + i] = options.series[0].data[i];
arr.push(json);
}
//---------------------------------------------------
arr: [
{b0:21},
{b1:23},
{b2:43},
{b3:17}
]
js的for循环中把 i 拼进属性名
最新推荐文章于 2023-06-30 11:38:16 发布