title: How to sum array value in chart.js inside loop function?
body: <p>I have this function:</p>
  
  <pre><code>click: function(e) {
    map.fitBounds(e.target.getBounds());
  
    myJSON.forEach(function (arrayItem) {
      if (arrayItem["Comune"] == e.target.feature.properties.NOME_COM.toUpperCase()) {
        $('.lead').html('');
        $('.lead').html('Comune di ' + arrayItem.Comune);
        $('#pulsante').html('');
        $('#pulsante').append('&lt;div id="emptyred"&gt;&lt;span style="opacity:0;"&gt;FMVPAFSB&lt;/span&gt;&lt;/div&gt;')
        $('#pulsante').append('&lt;div class="row" id="redditiButton"&gt;&lt;div class="col-lg-6"&gt;&lt;form&gt;&lt;label class="radio-inline btn btn-danger"&gt;&lt;input type="radio" id="generale" value="generale" name="radiored" autocomplete="off" checked&gt; Generale&lt;/label&gt;&lt;label class="radio-inline btn btn-danger"&gt;&lt;input type="radio" id="dettaglio" value="dettaglio" name="radiored" autocomplete="off"&gt; Dettaglio&lt;/label&gt;&lt;label class="radio-inline btn btn-danger"&gt;&lt;input type="radio" id="grafico3" value="grafico3" name="radiored" autocomplete="off"&gt; Grafico3&lt;/label&gt;&lt;/form&gt;&lt;/div&gt;')
        $('#chartContainer').append('&lt;canvas id="Chartedu"&gt;&lt;canvas&gt;')
  
        var datiedu = {
          "labels": ['Lavori non terminati', 'Lavori in corso', 'Lavori terminati'],
          "datasets": [{
            label: 'Numero',
            data: [arrayItem['Value 1'], arrayItem['Value 2'], arrayItem['Value 3']],
            backgroundColor: ['rgb(255, 99, 132)', 'rgb(255, 51, 95)', 'rgb(255, 0, 55)'],
            borderWidth: 1
          }]
        };
  
        var datiedu2 = {
          "labels": ['Lavori non terminati', 'Lavori in corso'],
          "datasets": [{
            label: 'Numero',
            data: [I WANT SUM HERE],
            backgroundColor: 'rgb(255, 99, 132)',
            borderWidth: 1
          }]
        };
  
        function grafo(dati, opzioni) {
          var grafobase = document.getElementById('Chartedu').getContext('2d');
          new Chart(grafobase, {
            type: 'doughnut',
            data: dati,
            options: opzioni
          });
        };
        grafo(datiedu);
      }
    });
  }
  </code></pre>
  
  <p>How do I sum <code>arrayItem['Value 1']</code> and <code>arrayItem['Value 2']</code> so that I can put it in the data of var <code>datiedu2</code>? It has to be inside the condition, but it doesn't work. If I try I obtain only the total sum of myJSON... which isn't useful.</p>