Math.round()

The Math.round() method is a standard round function. Math.round() rounds up if the number is at least halfway to the next integer value (0.5 or higher) and rounds down if not.

 
<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
    <script type="text/javascript">
        document.writeln(Math.round(25.9)); //26 
        document.writeln(Math.round(25.5)); //26 
        document.writeln(Math.round(25.1)); //25 

    </script>
</head>
<body>
</body>
</html>
  
Click to view the demo
Home 
  JavaScript Book 
    Essential Types  

Math:
  1. The Math Object
  2. Math min() and max() Methods
  3. Math.ceil()
  4. Math.floor()
  5. Math.round()
  6. random() Method