I have two arrays like
var array1 = [
    {
      id: '1',
      name: 'test'
    },
    {
      id: '2',
      name: 'test2'
    },
    {
      id: '3',
      name: 'test3'
    }
]
var array2=[
    {
      id: '2',
      name: 'test2'
    }
]
I want to loop through array 1 and find the same object and add more property in array 1
I have something like
 for(var i=0; i < array1.length; i++) {
     if(array2[i].id == array1[i].id){
         alert('find!')
     } 
 }
I understand my above codes don't work because the index is different. Can someone help me about this issue? Thanks a lot!
 
     
    