1.加相同字段
arr.forEach((value , index) => {
value['sex'] = 'men'
})
// 返回原数组arr
[
{name: 'lilei',age: '25',sex: 'men'},
{name: 'nike',age: '23',sex: 'men'},
{name: 'alisa',age: '23',sex: 'men'}
]
2.加不相同字段
let alarmUrl = [{
// alarmAccount: 0
url:'../alarm/alarmTaday?id=3'
}, {
// alarmAccount: 0
url:'../alarm/alarmTaday?id=1'
}, {
url:'../alarm/alarmTaday?id=5'
}, {
url:'../alarm/alarmTaday?id=4'
}, {
url:'../alarm/alarmTaday?id=6'
}]resuArr.forEach((it,index) =>{
it.url = alarmUrl[index].url
})