js自定义对象名
作者:互联网
let arrName = ['阿斯蒂','阿德福','爱他如何t'];
let dataArr = [];
let data = [{aaa:111,bbb:222,ccc:586},{aaa:54,bbb:98,ccc:78}]
data.forEach(ele=>{
let i = 0;
let obj = {};
for(var j in ele){
obj[arrName[i++]] = ele[j]
}
dataArr.push(obj)
})
console.log(dataArr)
标签:obj,自定义,对象,bbb,dataArr,ele,let,js,arrName 来源: https://blog.csdn.net/qq_36151452/article/details/120346036