# The Number toFixed() method

> Learn how the JavaScript Number toFixed() method returns a string with a number in fixed point notation, and how to set how many decimal digits to keep.

Author: Flavio Copes | Published: 2019-03-24 | Canonical: https://flaviocopes.com/javascript-number-tofixed/

You can use this method to get a string representing the number in fixed point notation:

```js
new Number(21.2).toFixed() //21
```

You can add an optional number setting the digits as a parameter:

```js
new Number(21.2).toFixed(0) //21
new Number(21.2).toFixed(1) //21.2
new Number(21.2).toFixed(2) //21.20
```
