I'm using this snippet to calculate the sum of two table cells.

var sum = 0;
$('.amount').each(function(){
    sum += parseFloat($(this).text());
});

$('.sum').text(sum);

But when the sum is for example 40.00 it displays as 40 and as picky as I am, i want it to display as 40.00. So... what to do?

Little (editable) demo: https://codepen.io/gentlemedia/pen/gGXJgR

I've found the answer myself :)

There is toFixed() method, so I had to add this to the sumvariable with the 2 as for the 2 decimals;

$('.sum').text(sum.toFixed(2));