title: Having trouble with implementing toFixed() for two decimals behind to comma
body: <p>This is my code</p>
  <pre><code>function computeTotal() {
   var total = 0;
    $('.price-selected-option').each(function() {
      total += parseFloat($(this).text().replace(',', '.'));
    })
    $('.total-price').text(total)
  }
  </code></pre>
  <p>I tried adding .toFixed(2) this way:</p>
  <pre><code>function computeTotal() {
   var total = 0;
    $('.price-selected-option').each(function() {
      total += parseFloat($(this).text().replace(',', '.').toFixed(2));
    })
    $('.total-price').text(total)
  }
  </code></pre>
  <p>But I (partly) understand this does not work because of .text in the same line. I’m very new to Javascript so any help is highly appreciated.</p>
  <p>So to be clear I always want 2 decimals te be displayed behind the comma. Also when for example te price is €8.5, then it should be €8.50 or when it’s €8 it should be €8,00</p>
  <p>I looked into <a href="https://stackoverflow.com/questions/4435170/how-to-parse-float-with-two-decimal-places-in-javascript">How to parse float with two decimal places in javascript?</a> but couldn’t find an answer because of my code being different i.e. includes .text</p>