/

HTML / CSS / JavaScript Tutorial

JavaScript Number method: toFixed()

[this page | pdf | back links]

The toFixed() method (when applied to JavaScript numbers) returns a string representing the number with a fixed number of digits after the decimal point.

 

It has the following syntax with the following parameters:

 

number.toFixed(n)

 

Parameter

Required / Optional

Description

n

Optional

(default is 0), Integer indicating number of digits after decimal point

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript Numbers and Math


Desktop view | Switch to Mobile