How to concatenate two array objects using jquery without adding duplicates
<p>I have two array objects :</p>

<pre><code> var arr1 =[{product_id: 2, name: 'stack'}, {product_id: 3, name: 'overflow'}];

 var  arr2 = [{product_id: 2, name: 'popo'},{product_id: 6, name: 'foo'}];
</code></pre>

<p>I do jquery like follows:</p>

<pre><code>$.each(arr1 , function(){ 
      var productId = this.product_id;
       $.each(arr2 , function(productId){
        if(this.product_id != productId){
           arr2.push(this);
        }
       }); 
   });
</code></pre>

<p>at the end </p>

<p>arr2 must look like</p>

<pre><code>     var  arr2 = [{product_id: 2, name: 'stack'}, {product_id: 3, name: 'overflow'},
             {product_id: 6, name: 'foo'}]
</code></pre>

<p>am i doing correct jquery coding..?</p>
