var sub_total = 0;
for(var i = 0; i <= 3; i++){
var rate = parseFloat(10).toFixed(2);
var quantity = parseFloat(15).toFixed(2);
var sub_total = parseFloat((rate * quantity) + sub_total).toFixed(2);
}
console.log(sub_total);
Expected Output:
450.00
Please help me How can I solve this why it giving output 150150150.00.
.toFixed()returns string600.00not450.00. Because loop has 4 iterations.