title: changing only changed property of an array or object comparing to next array or object
body: <p>I have two array <strong>a</strong> and <strong>b</strong> , array <strong>a</strong> is reactive array which contain reactive objects , My array is bind with my UI(i.e simply looping over <li> element and displaying data) when I update any objects of array or when I change any property of objects at array then my view layer automatically updates. Now I am trying to create function which receive my both array and which update only updated or changed property of array <strong>a</strong> without touching unupdated data of array or unupdated property of object which is inside array <strong>a</strong> looking at array <strong>b</strong>.</p>
  
  <p>I am not using any JavaScript liberty or framework. I had problem while deep cloning array <strong>b</strong> and placing cloned array in variable <strong>a</strong> I tried cloning but my problem was unsolved. Please help me. </p>
  
  <pre class="lang-js prettyprint-override"><code>
  var a = [
     {name:'mina' , age:18 , subject:'computer'}, //
     {name:'japan'}
  ];
  
  var b = [
    {name:'mina pandey' , age:19 , subject:'computer'},
    {name:'okkk' , aws:false}
  ]
  
  function LogicalUpdator(updating , newData) {     
     newData.forEach((el , index) =&gt; {
        if(typeof el == 'object'){
           var keys = Object.keys(el);
           keys.forEach(function(a){
             if(updating[index][a] !== el[a]){
               updating[index][a] = el[a];
             }
           })
        }else if(Array.isArray(el)){
           el.forEach(function(a){
             if(updating[index] !== el[a]){
               updating[index] = el[a];
             }
           })
        }else if(typeof el == 'string'){
  
        }
     });
  }
  
  BestUpdate(a , b);
  </code></pre>
  
  <p>I wrote more then 10 times but I couldn't solve it. I tried my best please help me.</p>
  
  <p>Detail problem according to code:-</p>
  
  <p>From array a[0] <code>name</code> should be converted to <code>mina pandey</code> looking at <code>b[0].name</code> likewise <code>a[0].age</code> should be converted to <code>19</code> looking at array <strong>b</strong> <code>b[0].age</code> but <code>a[0].subject</code> i.e <code>computer</code> should not be changed because <code>a[0].subject == b[0].subject</code>, similarly <code>a[1].name</code> i.e <code>japan</code> should be changed to <code>b[1].name</code> i.e<code>okkk</code> and new property <code>aws</code> should be added to <code>a[1]</code> because <code>b[1]</code> has new property <code>aws</code> looking at <code>a</code> similarly when new data <code>(i.e object, array, number, boolen , string)</code> is added on array <strong>b</strong> then same data should be added to array <strong>a</strong> same in removed case when any data is removed from array <strong>b</strong> then same data should be removed from array <strong>a</strong> as well. </p>
  
  <p>Please don't question me why aren't you directly updating array <strong>a</strong> (Reactive array) , There are some deep and genuine reasons which is related to my project which contain this small problem. Sorry I cannot explain about my project on stack overflow or any public sites.</p>
  
  <p>Please Help Me, I felt very difficult to solve this problem because I am just a learner I don't have deep knowledge to deal with such type of complex problem.</p>