Prev Demo
Round Decimal Value
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <script> var num = new Number(0.56); document.write(Math.round(num) + "<br />"); document.write(num.toFixed() + "<br />"); document.write(num.toFixed(1) + "<br />"); document.write(num.toFixed(2) + "<br />"); document.write(num.toFixed(3) + "<br />"); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output