title: Update array when found same value in Javascript
body: <p>i have two array. And i want update second array with first array data if found same data.
  Here is my first array :</p>
  
  <pre><code>var namaFile = [
              {
                  billingID: "90009388",
                  customerID: "C20121121221327_249",
                  name: "201409011141106_082895250262"
              },
              {
                  billingID: "90009400",
                  customerID: "7885000000007804",
                  name: "201410201141125_08287045931"
              },
              {
                  billingID: "90009388",
                  customerID: "C20121121221327_249",
                  name: "201410011171208_082895250262"
              }
          ];
  </code></pre>
  
  <p>Here second array :</p>
  
  <pre><code>var emailAddr = [
              {
                  customerID: "C20121121221327_249",
                  email: "fanjavaid@gmail.com"
              },
              {
                  customerID: "7885000000007804",
                  email: "arrosyad.fikri@sampoernatelekom.com"
              }
          ];
  </code></pre>
  
  <p>Here is my code, but won't work.</p>
  
  <pre><code>for (var i = 0; i &lt; namaFile.length; i++) {
              var files = [];
              for (var j = 0; j &lt; emailAddr.length; j++) {
                  if (namaFile[i].customerID == emailAddr[j].customerID) {
                      files.push(namaFile[i].name);
                      emailAddr[j]['files'] = files;
                  }
              }
          }
  
          console.log(emailAddr);
  </code></pre>
  
  <p>My expected result is like this :</p>
  
  <pre><code>var emailAddr = [
              {
                  customerID: "C20121121221327_249",
                  email: "fanjavaid@gmail.com",
                  files : [
                      "201409011141106_082895250262","201410011171208_082895250262"
                  ]
              },
              {
                  customerID: "7885000000007804",
                  email: "arrosyad.fikri@sampoernatelekom.com",
                  files : [
                      "201410201141125_08287045931"
                  ]
              }
          ];
  </code></pre>
  
  <p>How to create that result?
  Thank you.</p>