title: total sum of nested object value in array
body: <p>how to sum of the all the stationuserAmount values in the given array</p>
  <pre><code>            &quot;staions&quot;: [
                  {
                      &quot;name&quot;: &quot;Guwahati&quot;,                        
                      &quot;stationuser&quot;: [
                          {
                              &quot;name&quot;: &quot;Suranjan Dey&quot;,                                
                              &quot;stationuserAmount&quot;: &quot;190&quot;
                          }        
                         
                      ]
                  },                                     
                  {
                      &quot;name&quot;: &quot;Bhubaneshwar&quot;,                        
                      &quot;stationuser&quot;: [
                          {
                              &quot;name&quot;: &quot;Soubhagya Behera&quot;,                                
                              &quot;stationuserAmount&quot;: &quot;280&quot;
                          },
                          {
                              &quot;name&quot;: &quot;Om Prakash Sahoo&quot;,                                
                              &quot;stationuserAmount&quot;: &quot;280&quot;
                          }
                      ]
                  }             
              ]
  </code></pre>
  <p>I was tried with map and reduce on array values to find the total sum of the given array.</p>
  <pre><code>    1) const salesuserTotalCount = this.state.staions.map(items =&gt; ({          
      users: items.stationuser.reduce((a, b) =&gt; {return 
      a.stationuserAmount+b.stationuserAmount}    
      )}))
     2) const salesuserTotalCount = this.state.staions.map(items =&gt; ({
      ...items,
      users: items.stationuser.map(stationitems 
     =&gt;stationitems.stationuserAmount).reduce((a, c) 
                =&gt; { return a + c })}))
  </code></pre>