title: error TS2540: Cannot assign to 'i' because it is a constant or a read-only property
body: <p>3 error display in my terminal:</p>
  
  <ol>
  <li>error TS2540: Cannot assign to 'i' because it is a constant or a read-only property.</li>
  <li>error TS2540: Cannot assign to 'result' because it is a constant or a read-only property.</li>
  <li>error TS2322: Type '0' is not assignable to type 'void'.</li>
  </ol>
  
  <p><strong>component.ts</strong></p>
  
  <pre><code>total: any;
  totalPrice(): void {
        const result = 0;
        for (
          const i = 0; i &lt; this.datas.length; i++
        ) { const data = this.datas[i];
          result = result + data.total;
        }
        return result;
      }
  </code></pre>
  
  <p><strong>component.html</strong></p>
  
  <pre><code>&lt;td&gt;{{ data.name }}&lt;/td&gt;
      &lt;td&gt;{{ data.price }}&lt;/td&gt;
      &lt;td&gt;{{ data.quantity }}&lt;/td&gt;
      &lt;td&gt;{{ data.total }}&lt;/td&gt;`
  
  {{ totalPrice() }}
  </code></pre>
  
  <p>actually im running a list through *ngFor so the function totalPrice() is to add up all the data.total </p>