let a = [
{
index: 0,
input1: '12',
chenked: true
},
{
index: 1,
input1: '12',
chenked: true
},
{
index: 2,
input1: '12',
chenked: true
}
];
let b = [
{
index: 0,
input: '王',
input1: '',
chenked: false
},
{
index: 1,
input: '王',
input1: '',
chenked: false
},
{
index: 2,
input: '王',
input1: '',
chenked: false
},
{
index: 3,
input: '王',
input1: '',
chenked: false
}
];
let c = [];
for(let i=0;i<a.length;i++){
let index = b.findIndex(item => {
return item.index == a[i].index
})
if(index != -1){
b[index].input1 = a[i].input1
b[index].chenked = a[i].chenked
}
}
console.log(JSON.stringify(b))
console