How to format a float in javascript?

There are functions to round numbers. For example:

var x = 5.0364342423;
print(x.toFixed(2));

will print 5.04.

EDIT:
Fiddle

Leave a Comment