To format a float in JavaScript, use the Math.round() function. You can try to run the following code to round of a float −
Example
<!DOCTYPE html> <html> <body> <script> var val1 = 0.55843424; var res = Math.round(val1*100)/100; document.write(res); </script> </body> </html>