The JavaScript math round() method is used to get the closest integer value of a number.
Syntax:
Math.round(n)
Math.round(n)
Math.round(n)
Parameters
n: It represents the number whose closest integer value has to be got.
Returns
Closest integer value of a number.
Example:
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Math.round(45.7864));
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Math.round(45.7864));
</script>
</body>
</html>
<!DOCTYPE html> <html> <body> <script> document.writeln(Math.round(45.7864)); </script> </body> </html>