title: How can able to perform addition of array elements
body: <p>expected output should be like  category ["Agri","water"] values of area should be [3,3]
      I have tried with removing duplicates in the category array if duplicate found then area addition should take place</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;h1&gt;Joining Two Arrays&lt;/h1&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;
  
  &lt;script&gt;
  var twodim = new Array(); 
  var category = ["Agri", "Agri","water"];
  var area = [1, 2, 3];
  
                 for (n = 0; n &lt; category.length; n=n+1)
                 {
  
                 twodim.push([category[n],area[n]]);
  
                 }
  
  alert(twodim);
  
  document.getElementById("demo").innerHTML = myChildren;
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>