title: Calculations inside of loop and how to return sum of values . Vuejs
body: <p>I'm very beginner to javascript and need to navigate me on the right way how to use it in my task.</p>
  
  <p>I have a massive financial instrument developed on php and I need to build complex financial calculator that shows everything with reactivity. I need help to figure out how to make complex calculations with many <code>if</code> statements inside of the loop and then sum output value from each object in array and return total summed value. Using Vuejs for this.</p>
  
  <p>So my <code>cashDividends()</code> must be a sum of calculated values from each object in the loop.</p>
  
  <p>Below I put a piece of code to understand problem I'm facing.</p>
  
  <pre><code> new Vue({
      el: "#waterfall",
      data() {
          return {
          info: {
              cash_dividends: true,
              converted_liabilities: true,
          },
          equities: [
              @foreach($preferredEquities as $equity)
              { name: '{{ $equity-&gt;name }}', id: {{ $equity-&gt;id }} },
              @endforeach
              ]
          }
      },
      computed: {
          remainingExit () {
              return this.form.exit_value - this.form.uncovered_debt - this.form.transaction_fees
          },
          cashDividends() {
      //I supposed should be something like this.     
            this.equities.forEach(function(equity)
            {
              //Here I make a lot of calculations with bunch of if statements using object and DOM input values. for each object 
  
            }
            // And here I need to return sum of calculated values from each object (equity) in array 
          }
      },
  </code></pre>
  
  <p>Any tips guys, just need to figure out the concept.</p>