title: How to calculate total price of column in angular 9?
body: <p>I want to calculate the total price, total quantity and total counted(#) of each column.</p>
  <h1>| Item  | Price | Quantity |</h1>
  <p>1    | Mouse | 500   |  1       |
  2    | Wire  | 100   |  2       |
  TI:3 |       |TP:600 | TQ:3     |  &lt;---Required Output</p>
  <p>My Js is not working to get required output? Help me to get it</p>
  <p><strong>Html</strong></p>
  <pre><code>     &lt;table class=&quot;table table-hover&quot; *ngIf=&quot;secondTableData.length&quot; id=&quot;sum_table&quot;&gt;
          &lt;thead&gt;
           &lt;tr class=&quot;table-primary&quot; class=&quot;titlerow&quot;&gt;
              &lt;td&gt;#&lt;/td&gt;
              &lt;td&gt;Item&lt;/td&gt;
              &lt;td&gt;Quantity&lt;/td&gt;
              &lt;td&gt;Price&lt;/td&gt;
              &lt;td&gt;Action&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
       &lt;tbody&gt;
          &lt;tr *ngFor=&quot;let newdata of secondTableData let i=index;&quot;&gt;
              &lt;td class=&quot;netSn&quot;&gt;{{i+1}}&lt;/td&gt;
              &lt;td&gt;{{ newdata.itemName }}&lt;/td&gt;
              &lt;td class=&quot;netQt&quot;&gt;{{ newdata.Quantity }}&lt;/td&gt;
              &lt;td class=&quot;netSum&quot;&gt;{{ newdata.retailRate }}&lt;/td&gt;
              
          &lt;/tr&gt;
          &lt;tr class=&quot;totalColumn&quot;&gt;
              &lt;td class=&quot;totalCol&quot;&gt;TI:&lt;/td&gt;  &lt;!--I want to Diaplay Total counted #  --&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td class=&quot;totalCol&quot;&gt;TQ:&lt;/td&gt;  &lt;!--I want to Display Total Quantity  --&gt;
              &lt;td class=&quot;totalCol&quot;&gt;TP:&lt;/td&gt;  &lt;!--I want to  Display Total Price  --&gt;
              
          &lt;/tr&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
  </code></pre>
  <p><strong>Js:</strong></p>
  <pre><code>    $(document).ready(function () {
  
          var $dataRows = $(&quot;#sum_table tr:not('.totalColumn, .titlerow')&quot;);
  
          $dataRows.each(function () {
              $(this).find('.netSn').each(function (i) {
                  totals[i] += parseInt($(this).html());
              });
  
              $(this).find('.netQt').each(function (i) {
                  totals[i] += parseInt($(this).html());
              });
  
              $(this).find('.netSum').each(function (i) {
                  totals[i] += parseInt($(this).html());
              });
          });
          $(&quot;#sum_table td.totalCol&quot;).each(function (i) {
              $(this).html(&quot;&quot; + totals[i]);
          });
  
      });
  </code></pre>
  <p><strong>Component.ts:</strong></p>
  <pre><code>    //To Copy data of First table to Second table after clicking first table
    secondTableData = [];
    updateSecondTable(data) {
      let foundItem = this.secondTableData.find((item) =&gt; item.itemName === data.itemName);
      if (foundItem) {
        foundItem.Quantity += 1;
        foundItem.retailRate += data.retailRate;
        return;
      }
      this.secondTableData.push({
        itemName: data.itemName,
        Quantity: 1,
        retailRate: data.retailRate,
      })
    }
  </code></pre>