I would like to format my numbers to always display 2 decimal places, rounding where applicable.
Examples:
number display ------ ------- 1
Convert a number into a string, keeping only two decimals:
var num = 5.56789; var n = num.toFixed(2);
The result of n will be:
5.57