Javascript: How to Add Commas to 2 Decimal Places with toLocaleString() and toFixed()

// Calculate Estimated Savings
estimatedyes_value = tankmixreward_value+earlybookreward_value+cerealacrereward_value;
estimatedyes_rate = tankmixreward_rate+earlybookreward_rate+cerealacrereward_rate;
document.getElementById('estimated-total').innerHTML =  "$" + estimatedyes_value.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
estimatedyes_rate = estimatedyes_rate.toFixed(2);
document.getElementById('estimated-peracre').innerHTML =  "$" + estimatedyes_rate.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) + "/ac";

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.