有以下两个数组, 其中'name'后缀的数字由arr决定。arr数组有多长,array里的name就有多少个
let arr=[0,1,2,3];
let array=[
{
name0:'1',
name1:'',
name2:'',
name3:'',
},
{
name0:'',
name1:'',
name2:'2',
name3:'',
},
{
name0:'',
name1:'6',
name2:'',
name3:'',
},
{
name0:'',
name1:'',
name2:'',
name3:'9',
},
]
如何使得数组中相同key的value一样,效果如下
array=[
{
name0:'1',
name1:'6',
name2:'2',
name3:'9',
},
{
name0:'1',
name1:'6',
name2:'2',
name3:'9',
},
{
name0:'1',
name1:'6',
name2:'2',
name3:'9',
},
{
name0:'1',
name1:'6',
name2:'2',
name3:'9',
},
]