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)
上一篇:Linux学习-第17周


下一篇:String和StringBuffer和StringBuilder的区别