JavaScript Math.round() Method

JavaScript math.round method; In this tutorial, i am going to show you javaScript Math.round Methods & how to use it.

JavaScript Math.round method

  • Math Round Method
  • Syntax of JavaScript Math.round
  • Example of Math.round() Method

Math Round Method

The Math.round() method rounds a number to the nearest integer. Note: 2.49 will be rounded down (2), and 2.5 will be rounded up (3).

Syntax of JavaScript Math.round

The syntax of javaScript math.round method; as follows:

Math.round(var);

This above syntax, you will be see function accepts a single parameter. This is the number that you want to round.

Below we are going to show you some of the javascript math.round() examples.

Example of Math.round() Method

In this math.round () function example, we have passed the value in math.round function 6.6 and this function will round off our value and return it to us :

 var round =Math.round(6.6); 
 document.write("Number After Round : " + round);

Let’s see with nagetive value example – In this math.round () function, we have passed the nagetive value in math.round function -6.6 and this function will round off our value and return it to us:

 var round =Math.round(-6.6); 
 document.write("Number After Round : " + round);

More JavaScript Tutorials

Leave a Comment