修改对象的键
let t = [{ name:"王五", age:28, sex:"man" }, { name:"王yi", age:30, sex:"man" }, { name:"王san", age:5, sex:"man" } ] let newData = t.map(item => { return { templateId: item.name, designList: item.age, sex:item.sex } }) console.log(newData);
结果为: