Sep
23
2011

Javascript Round Number and Display Two Decimal Points

Quick tip of the Day: Javascript Rounding and always display Two Decimal Points

parseFloat(Math.round(YOUR_VARIABLE * 100) / 100).toFixed(2);

Example:

console.log(parseFloat(Math.round(4.34892039 * 100) / 100).toFixed(2));
// logs 4.35 in your console

Leave a comment

Show/Hide Footer Actions

Status: Available for your project.