# Using Math round() function to coding in Javascript/JS

This JavaScript tutorial explains how to use the math characteristic called round() with syntax and examples.

## Description

In JavaScript, round() is a feature that is used to return a variety rounded to the nearest integer value. Because the round() feature is a static function of the Math object, it need to be invoked via the placeholder object called Math.

## Syntax

In JavaScript, the syntax for the round() feature is:

``Math.round(number);``

Parameters or Arguments

number

The number that will be rounded.

## Returns

The round() characteristic returns a wide variety rounded to the nearest integer. In different words, the range is rounded to 0 decimal places.

If the range is a negative value, the round() feature rounds up towards zero which is one-of-a-kind behavior than the spherical function in different languages.

## Note

Math is a placeholder object that incorporates mathematical functions and constants of which round() is one of these functions.

## Example

Let’s take a seem to be at an example of how to use the round() feature in JavaScript.

For example:

``````console.log(Math.round(32.65));
console.log(Math.round(8.1));
console.log(Math.round(-4.2));``````

In this example, we have invoked the round() feature the use of the Math class.

We have written the output of the round() feature to the net browser console log, for demonstration purposes, to exhibit what the round() characteristic returns.

The following will be output to the web browser console log:

``````33
8
-4``````

In this example, the first output to the console log lower back 33 which is 32.65 rounded to the nearest integer.

The 2d output to the console log back 8 which is 8.1 rounded to the nearest integer.

The 0.33 output to the console log returned -4 which is -4.2 rounded to the nearest integer. Notice that when dealing with terrible numbers, the round() feature rounds up closer to zero and in this case, again -4 and no longer -5. This conduct is distinctive than the spherical functions in different languages.