JS Número 2 Placas decimais
(3.141596).toFixed(2); // 3.14
garzj
(3.141596).toFixed(2); // 3.14
let money = 1.6;
money.toFixed(2); // 1.60
var myNumber=12.2345;
var myNumberWithTwoDecimalPlaces=parseFloat(myNumber).toFixed(2); //12.23
var example = 3.35464464374256 ;
example = parseFloat(example.toFixed(2)) ; // example == 3.35
Number(1).toFixed(2); // 1.00
Number(1.341).toFixed(2); // 1.34
Number(1.345).toFixed(2); // 1.34 NOTE: See andy's comment below.
Number(1.3450001).toFixed(2); // 1.35
var totalAmount = 0;
totalAmount = Number($("#sub_amount").val()) + Number($("#vat_amount").val());
totalAmount = totalAmount.toFixed(2);
$('#total_amount').val(totalAmount);
//@sujay