# How to Use the Math.round() Function in JavaScript

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1719650976359/6ca9860d-4bbf-40bd-82f7-0d138b296170.png align="center")

As you see above, I typed out this code inside the console. So, how do you get to the console? Simply go to the website you built, right-click, and a small window will open. At the bottom, you will see "Inspect." Click on it, and a page like the one above will open. Click on the "Console" tab at the top right to see the console panel.

In the console, we can solve any kind of math problems. Now, why are we using the Math.round() function? When we calculate two numbers, if the result is a decimal, we want it as a rounded value. So, we use this function. The syntax is:

```javascript
Math.round();
```

If the decimal value is 0.5 or above, it will round up to the next whole number. If it's below 0.5, it will round down to the previous whole number.
